I'm cleaning-up my database, and for the sake of keeping SPAM down to a minimum I would like lock all of the wordpress user accounts that do not contain an e-mail address. Any ideas how to do this?

Please keep in mind that my level of PHP experience is "code tweaker" - most of the time I don't know what I'm doing but I'm able to personalize someone else's solution to my needs. My level of MYSQL is also pretty low - I can get around in there but I don't know how to make declarations that make things happen.

  • 1
    by lock do you mean you want to prevent them from logging in, or delete them from the database entirely? thase are two different solutions.
    – majick
    Apr 10, 2016 at 9:14
  • If you just want to deactivate the user accounts and not delete them, then please take a look at this plugin. Apr 10, 2016 at 13:32
  • I don't want to delete them from the database, just de-activate their account. The plug-in ItsMePN linked to is helpful - though I have lots of users and I was hoping for a more automated way to find and group accounts without e-mail, and then de-activate them. Thanks!
    – Laura P.
    Apr 11, 2016 at 4:50
  • This can be done in the database. If you're using that plugin then it looks like you need to insert one row per deactivated user into wp_usermeta for each user with user_id pointing to them, meta_key='wpduact_status' and meta_value='inactive'. That should be easy enough to do in SQL if you can select the set of users you're interested in. I can't see how to create an account without an email address, though: what do your bad accounts look like? Is user_email in the wp_users table an empty string, or whitespace, or a null, or something else? Thanks!
    – Rup
    Apr 11, 2016 at 9:36


Your Answer

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

Browse other questions tagged or ask your own question.