Moderator
t-p
(@t-p)
Try reviewing this tutorial https://www.wpbeginner.com/plugins/how-to-bulk-delete-wordpress-users-with-specific-roles/
Hi @t-p
I already checked that actually, this plugin is overloading my server. Need a more efficient way.
Thanks.
You could list fewer users per page, which means having to do the same thing many more times. It’ll work, but it’s hardly efficient.
A custom script could be created that gets x number of users at once, then loops through each user and deletes all related data before removing the user itself. Schedule a WP Cron task to repeat the same script at some reasonable interval. Tailor x to be as large as possible to work reliably without overloading anything.
Once no more users matching the criteria can be found, I believe the script can remove itself from the cron tasks. But if the script simply returns when no users are found, it wouldn’t have a huge impact if it just kept running until you have a chance to manually remove it.
I will start a new thread.
Anyone following along can continue at https://wordpress.org/support/topic/what-wordpress-php-code-can-delete-all-subscribers/