Skip to content

Instantly share code, notes, and snippets.

@tuongpgjz
Last active November 13, 2021 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuongpgjz/b9742d35e6df644c7ecf025587f2193d to your computer and use it in GitHub Desktop.
Save tuongpgjz/b9742d35e6df644c7ecf025587f2193d to your computer and use it in GitHub Desktop.
Remove empty product categories/tags on WooCommerce
-- 1) Go to WooCommerce > Status > Tools
-- 2) Find section "Term counts" and press Recount Terms
-- 3) Run this one with phpMyAdmin or tool similar
-- If you want to remove tags, change 'product_cat' to 'product_tag'
-- Anthony from SalesGen.io
DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE count = 0 and taxonomy = 'product_cat')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment