Skip to content

Instantly share code, notes, and snippets.

@eon01
Created September 20, 2015 13:02
Show Gist options
  • Save eon01/952e9da10c544ea5feb8 to your computer and use it in GitHub Desktop.
Save eon01/952e9da10c544ea5feb8 to your computer and use it in GitHub Desktop.
DELETE p FROM wp_posts p WHERE p.post_type = 'product';
DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
DELETE tr FROM wp_term_relationships tr INNER JOIN wp_term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy != 'link_category' AND tr.object_id NOT IN ( SELECT ID FROM wp_posts );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment