Created
September 16, 2021 16:33
-
-
Save jarodthornton/f3a2a389722f02c1f5819a2363f3b2bc to your computer and use it in GitHub Desktop.
WooCommerce Clear Product Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE relations.*, taxes.*, terms.* | |
FROM wpa12_term_relationships AS relations | |
INNER JOIN wpa12_term_taxonomy AS taxes | |
ON relations.term_taxonomy_id=taxes.term_taxonomy_id | |
INNER JOIN wpa12_terms AS terms | |
ON taxes.term_id=terms.term_id | |
WHERE object_id IN (SELECT ID FROM wpa12_posts WHERE post_type='product'); | |
DELETE FROM wpa12_postmeta WHERE post_id IN (SELECT ID FROM wpa12_posts WHERE post_type = 'product'); | |
DELETE FROM wpa12_posts WHERE post_type = 'product'; | |
DELETE a,c FROM wpa12_terms AS a | |
LEFT JOIN wpa12_term_taxonomy AS c ON a.term_id = c.term_id | |
LEFT JOIN wpa12_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id | |
WHERE c.taxonomy = 'product_tag'; | |
DELETE a,c FROM wpa12_terms AS a | |
LEFT JOIN wpa12_term_taxonomy AS c ON a.term_id = c.term_id | |
LEFT JOIN wpa12_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id | |
WHERE c.taxonomy = 'product_cat' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment