WordPress – How to remove a large number of email-bounced users

One of my wordpress web sites has over 20,000 users. Most of these users were verified when they signed up for their account, but there are still a large number of bounce email I get every time I send out a user mailing. There are also a number of “unsubscribe” messages that I get.

I searched around for a plug-in that would allow me to upload a CSV file and would then bulk-delete the users but none was found. Instead of creating a new plug-in I decided to figure out a way of doing some form of bulk removal of users. Here is what I did (note: my site does not have any “contributor” users):

  1. For each bounce email or unsubscribe request I receive I copy the email address
  2. Execute this query in your wordpress database:[quote style=”boxed”] update wp_usermeta SET meta_value=’a:1:{s:11:”contributor”;s:1:”1″;}’ where meta_key=’wp_capabilities’ AND user_id= (SELECT ID from wp_users where user_email=’theuser@example.com’);[/quote]
  3. I repeat that for all users
  4. Go to the Users panel, click on “Contributors”
  5. Click the check mark all
  6. Bulk Delete

Again, this works for me because everyone is a “Subscriber” and the “Contributors” list is always empty so I use that to store my temporary delete list.