Created
August 22, 2016 16:12
-
-
Save techskilled/310d97df00e3e24764ecd666b5923d67 to your computer and use it in GitHub Desktop.
WooCommerce SQL to delete users who have no orders or posts
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
DELETE from wp_users where wp_users.ID not in ( | |
SELECT meta_value FROM wp_postmeta WHERE meta_key = '_customer_user' | |
) AND wp_users.ID not in ( | |
select distinct(post_author) from wp_posts | |
); | |
delete from wp_usermeta where wp_usermeta.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