-
-
Save JFOC/579c1adc297bd19f32d54f6e1996d68f to your computer and use it in GitHub Desktop.
Delete SPAM users from WordPress/WooCommerce. They usually never have a first name set
This file contains 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
# Use with EXTREME CAUTION | |
DELETE FROM wp_users WHERE ID IN ( SELECT user_id FROM wp_usermeta | |
WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%subscriber%' | |
AND user_id NOT IN ( SELECT user_id FROM wp_usermeta | |
WHERE meta_key = 'billing_first_name' AND meta_value != '' | |
AND user_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%' | |
AND user_id NOT IN ( SELECT user_id FROM wp_usermeta | |
WHERE meta_key = 'billing_first_name' AND meta_value != '' | |
AND 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