Skip to content

Instantly share code, notes, and snippets.

Created October 12, 2022 02:55
What would you like to do?
Remove all empty categories in WooCommerce
-- Run this SQL commands from PhpMyAdmin or similar ways
-- change the wp_ to your tables prefix to make it works
-- Script from
DELETE FROM wp_term_taxonomy WHERE taxonomy = 'product_cat' AND count = 0;
DELETE t FROM wp_terms t LEFT JOIN wp_term_taxonomy tt ON tt.term_id = t.term_id WHERE tt.term_id IS NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment