Skip to content

Instantly share code, notes, and snippets.

@philipjohn
Created May 15, 2023 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipjohn/5d8d3b98abbedec0bf38bee0fd254606 to your computer and use it in GitHub Desktop.
Save philipjohn/5d8d3b98abbedec0bf38bee0fd254606 to your computer and use it in GitHub Desktop.
# Delete all users with a role of "subscriber" from a WordPress database.
#
# Assumes the `wp_` table prefix
DELETE FROM wp_users WHERE ID IN ( SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%subscriber%' );
DELETE FROM wp_usermeta WHERE user_id IN ( SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%subscriber%' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment