Created
April 23, 2025 16:41
-
-
Save paulcushing/84b09d7966c47978c26bfe2759a34212 to your computer and use it in GitHub Desktop.
When you need to remove subscribers from a WordPress server and there are too many to user the web interface, use this SQL to delete them and then cleanup the associated metadata.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wordpress Management | |
# Remove all subscribers using SQL Query | |
# Delete all of the users with Subscribe capabilities | |
DELETE FROM wp_users WHERE ID IN ( SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%subscriber%' ); | |
# Cleanup the meta (bonus! it cleans up all meta not associated with an existing account) | |
DELETE FROM wp_usermeta WHERE user_id NOT IN ( SELECT id FROM wp_users ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment