Skip to content

Instantly share code, notes, and snippets.

@bmakowski
Created October 28, 2020 18:35
Show Gist options
  • Save bmakowski/e2ff8437b4fc838e83dffaec86a1b158 to your computer and use it in GitHub Desktop.
Save bmakowski/e2ff8437b4fc838e83dffaec86a1b158 to your computer and use it in GitHub Desktop.
clear all orders, subscriptions and customers
delete
p,pm
from wp_posts p
join wp_postmeta pm on pm.post_id = p.id
where p.post_type = 'shop_order';
delete
p,pm
from wp_posts p
join wp_postmeta pm on pm.post_id = p.id
where p.post_type = 'shop_subscription';
delete
u,um
from wp_users u
join wp_usermeta um on um.user_id = u.id
where um.meta_key = 'wp_user_level' and um.meta_value = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment