Skip to content

Instantly share code, notes, and snippets.

@tuongpgjz
Created October 12, 2022 02:55
Show Gist options
  • Save tuongpgjz/5dc426904e7e4d6fb78e3c99af91e554 to your computer and use it in GitHub Desktop.
Save tuongpgjz/5dc426904e7e4d6fb78e3c99af91e554 to your computer and use it in GitHub Desktop.
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 SalesGen.io
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