I have a Wordpress site with thousands of editors. I cant delete them from the WP dashboard as its to slow.

I need a query to delete all the editor users and their posts from PhpMyAdmin?


  • Single site, or Multisite network? – Pat J Apr 19 at 3:22
  • Thanks, single site! – DarrenLee Apr 19 at 3:38

It's a three step process.

  1. First, get a list of Editors using WP_User_Query.

  2. Get a list of each user's posts using get_posts and delete them using wp_delete_post.

  3. Lastly, delete the user itself using wp_delete_user.

  • Thank you so much! – DarrenLee Apr 19 at 4:38
  • So what would I type in the PhpMyadmin query tool? – DarrenLee Apr 19 at 4:41
  • You don't. This is a php process and you'll need to code them. The SQL quarries will be handled by WordPress itself. – Abhik Apr 19 at 4:42
  • Ok thank you for your help – DarrenLee Apr 19 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.