Reputation: 21
We are using the Press Permit Plugin for permissions of users in wordpress. When we delete a user from the wp-admin panel, the user remains present in the database, so we have to connect to phpMyAdmin to delete it manually. Because if we want to recreate a user with an email, and a user with this email still in database we can’t recreate the user.
Why is the user deleted from wp-admin not delete from the database?
Upvotes: 2
Views: 7664
Reputation: 178
I was searching for a similar solution and landed here. However, I had to look further and find solutions so sharing this here.
First, find the wp_users table.
You need to delete the user from this table. Either do this visually (PHPMyAdmin) or run a SQL query to delete the user by id.
# delete user by id
## warning, running this code on your database will delete user with id 1 :-)
DELETE FROM `wp_users` WHERE ID = 1;
## you can achieve same result with user_login
# replace login name by name of the user
DELETE FROM `wp_users` WHERE user_login = 'login name';
# You can also use other columns like user_nicename, user_email and so on.
# grab the user_id of the user you want deleted and run this code..
## warning, this code will remove all rows from wp_usermeta where user_id is 1
DELETE FROM `wp_usermeta` WHERE user_id = 1
I hope this helps.
Upvotes: 2
Reputation: 47
This is because plugins such as that write to their own tables in the database. You'll see a lot of plugins, such as memberpress and buddypress add their own table and the users will be on that table as well.
Upvotes: 1
Reputation: 1
I don't think this is related to Wordpress itself, but most likely the plugin you mentioned. Users as you stated when deleted from WP admin, should be deleted permanently from the database as well.
Upvotes: 0