Make a backup of your database earlier than you learn any additional. I am not accountable should you delete your customers and can’t convey them again. You’ve been warned.
First delete the customers, the place the
wp_users.ID is just not discovered within the
wp_posts.post_author column. We use distinct right here as a result of a single consumer ID might be the writer of one thousand posts, and be returned one thousand occasions once we solely want it as soon as.
delete from wp_users the place wp_users.ID not in (choose distinct(post_author) from wp_posts);
Think your accomplished? Look in your
Now we delete all of the
wp_usermeta entries the place the
wp_usermeta.user_id just isn’t discovered within the
wp_users.ID column. Similair to the final question however simply pointing at totally different tables and eradicating the distinct because the ID column is already all distinctive values.
delete from wp_usermeta the place wp_usermeta.user_id not in (choose ID from wp_users);