q292u

WordPress Database – Delete Orphaned Usermeta

Wordpress Technical

Delete Orphaned Usermeta..

After using SQL to bulk-delete users, you’ll be left with (potentially a lot) of orphaned records in the “usermeta” table. You don’t want that. It’ll just waste space and clog things up.
After deleting 1000 user records, I had 20000 orphaned usermeta records – you get the picture..

From PLESK web admin, or similar:

delete FROM wp_usermeta WHERE user_id NOT IN (
SELECT ID
FROM wp_users
);

** BACK UP YOUR DATABASE FIRST!

Please note: You should NEVER leave your tables with the default “wp_” prefix. Or have a user called “admin”, or a user with id=1. That’s just for start!
Let us secure your WordPress site for you:
http://www.q292u.com/services/secure-your-wordpress-site-our-new-fiverr-gig

Exit mobile version