Skip to content

Instantly share code, notes, and snippets.

@crissoca
crissoca / delete.sql
Created November 21, 2015 00:54 — forked from pmgarman/delete.sql
How to find and delete orphaned product variations from WooCommerce sites.
DELETE o FROM `wp_posts` o
LEFT OUTER JOIN `wp_posts` r
ON o.post_parent = r.ID
WHERE r.id IS null AND o.post_type = 'product_variation'