1

I have a WordPress site with 65,000 registered users, about 10,000 of those users are spam bots, inactive account, hard email bonces etc.

I have them gathered in a CSV list, how can I use that csv list to delete those users from my WordPress site?

I haven't been able to find a plugin that does it.

3
  • What is the structure of your CSV? Commented Mar 1, 2015 at 21:55
  • Why don't you write the code yourself? You just have to loop through the CSV, match the data with the users table and delete users that match. That's beginner PHP/WordPress. Commented Mar 2, 2015 at 8:31
  • If you try and are stuck, you can always come back here :) Commented Mar 2, 2015 at 8:32

3 Answers 3

1

You could try something like this.

DELETE 
FROM  wp_users 
WHERE  ID in ( 5506, 5507,... );

Make sure to try it on a staging area first and backup your database.

1

You can delete lots of users via SQL using emails:

DELETE 
FROM  wp_users 
WHERE  user_email in ( '[email protected]', '[email protected]' );

You can generate list of emails in line via Excel.

Or, you can exclude using Usernames too:

DELETE 
FROM  wp_users 
WHERE  user_login in ( 'username1', 'username2', 'username3' );

Be sure to make a backup beforehand.

-1

Have you tried the Stop Spammers plugin

I have found that can be pretty effective - not 100% - but good at stopping spam registrations - you can add various APIs.

I don't think you can do the CSV thing you need specifically, but I'm pretty sure you can cut into your existing db - and prevent further spam registrations.

Side-note, I find CloudFlare is pretty good at protecting the sign up process from bots.

Update:

The plugin cannot delete existing users:

Unfortunately, WordPress did not record the IP address of User registrations prior to version 5.0. This is a design flaw in WordPress. They do record the IP of comments. I cannot run a check against logins without their IP address, so you have to remove users the old fashioned way, one at a time. You might try listing the emails of all registered users, and then deleting them. You can then ask all users to re-register, but that would probably annoy your legitimate users.

1
  • 1
    This isn't an answer, it's a recommendation
    – Tom J Nowell
    Commented Aug 25, 2020 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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