Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created November 27, 2015 09:25
Show Gist options
  • Save corsonr/dedfa5ca719488291170 to your computer and use it in GitHub Desktop.
Save corsonr/dedfa5ca719488291170 to your computer and use it in GitHub Desktop.
Delete WooCommerce Orphaned Variations
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'
@modul4richard
Copy link

can you explain why it has..

DELETE o

while this one..
https://gist.github.com/corsonr/cb4541c0c3d8303c6f5e#file-gistfile1-txt
is..

SELECT *

cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment