How can I safely delete only .ru related emails?

I am currently in the process of removing over 2k emails that have .ru in their email or .ru in their username and it is taking longer than expected using WordPress innate bulk delete option. Is there a better way.

I did find that you can use (wp user delete) somehow, but it is not coming to me on how to use this to JUST delete these .ru related emails/usernames.

3 Comments
  1. You can use WP-CLI for this:

    `wp user list –field=ID –email=*.ru | xargs wp user delete –reassign=1 –yes`

    **–reassign=1** where 1 is your admin id. This is just to reassign any posts made by a deleted user.

    Another way you could do this is to just run a sql query. There are plugins you can use to run a sql query against your database or you can run it in phpMyAdmin. Make sure you do a backup, just in case.

    `DELETE FROM wp_users`

    `WHERE user_email LIKE ‘%@%.ru’;`

    .ru in their username:

    `DELETE FROM wp_users`

    `WHERE user_login LIKE ‘%.ru%’;`

    For the future, use some kind of spam protection. Turnstile (free) works well against bots. OOPSpam (paid) is also great for both bots and manual spam.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer