I have 20,000 fake subscribers I'd like to get rid of. The admin panel only lets you delete 200 at a time.

How can I bulk delete all Wordpress subscribers via MySQL?


I ended up deleting all users who had not made a post using the following two queries:


DELETE FROM wp_users
WHERE ID NOT IN (SELECT post_author FROM wp_posts)


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

You can use :

$blogusers = get_users( 'role=subscriber' );
// Array of WP_User objects.
foreach ( $blogusers as $user ) {
    $user_id = $user->ID;
    wp_delete_user( $user_id );
  • in functions.php? – Vinnie James Apr 22 '17 at 19:49
  • If you run query for once then you can use in functions.php with if( isset($_GET['remove_user'])){ // Here add code } Now call site url like : site-url.com/?remove_uesr – Punitkumar Patel Apr 22 '17 at 19:50
  • like this way: siteurl.com?remove_user ? – Vinnie James Apr 22 '17 at 19:52
  • Once you delete subscriber you can delete script. – Punitkumar Patel Apr 22 '17 at 19:52
  • 1
    siteurl.com/?remove_user – Punitkumar Patel Apr 22 '17 at 19:53

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.