Last active
January 9, 2022 10:12
-
-
Save tuongpgjz/dd8450e9d00d556162635301f6ee1157 to your computer and use it in GitHub Desktop.
Remove all product data and product meta
This file contains 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
-- This SQLs remove products and their meta data on your store | |
-- SalesGen.io | |
-- delete product info | |
DELETE FROM wp_posts WHERE post_type = 'product_variation'; | |
DELETE FROM wp_posts WHERE post_type = 'product'; | |
-- After remove products from posts table, must clear data in postmeta to reduce database size. | |
-- Delete orphan postmeta | |
DELETE pm | |
FROM wp_postmeta pm | |
LEFT JOIN wp_posts p ON pm.post_id = p.ID | |
WHERE p.ID IS NULL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment