clear product woo sql

Solutions on MaxInterview for clear product woo sql by the best coders in the world

showing results for - "clear product woo sql"
Luigi
11 Oct 2020
1-- Delete all WooCommerce products
2DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
3DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
4DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');
5
6-- Delete orphaned postmeta
7DELETE pm FROM wp_postmeta pm
8LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
9WHERE wp.ID IS NULL;
10
11
12-- Delete Tags e Categorias
13
14DELETE a,c FROM wp_terms AS a 
15LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
16LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id
17WHERE c.taxonomy = 'product_tag';
18
queries leading to this page
clear product woo sqlclear product woo sql