Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remove WooCommerce products by category name or a part of category name
-- replace category_name by your category name
DELETE FROM wp_posts WHERE ID IN (SELECT object_id from wp_term_relationships WHERE term_taxonomy_id IN(SELECT term_taxonomy_id FROM `wp_term_taxonomy` WHERE taxonomy = 'product_cat' AND term_id IN (SELECT term_id FROM `wp_terms` WHERE name like '%category_name%')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment