Skip to content

Instantly share code, notes, and snippets.

@camaech
Last active August 18, 2016 21:35
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 camaech/ebb9e31517a575cd8930175a38974ad9 to your computer and use it in GitHub Desktop.
Save camaech/ebb9e31517a575cd8930175a38974ad9 to your computer and use it in GitHub Desktop.
DELETE p FROM vsc_posts p
WHERE p.post_type = 'product';
DELETE pm FROM vsc_postmeta pm
LEFT JOIN vsc_posts vsc ON vsc.ID = pm.post_id
WHERE vsc.ID IS NULL;
DELETE tr FROM vsc_term_relationships tr
INNER JOIN vsc_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 vsc_posts );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment