Last active
November 13, 2021 16:16
-
-
Save tuongpgjz/b9742d35e6df644c7ecf025587f2193d to your computer and use it in GitHub Desktop.
Remove empty product categories/tags on WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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