Quick tip: get_terms with all terms

The get_terms WordPress function is listing all your terms for a given taxonomy (or taxonomies).

However, the default callback returns only the terms with entries. Therefore your empty terms won’t be visible unless you use the hide_empty parameter with a false value, like this:


$product_terms = get_terms( ‘product’, array( ‘hide_empty’ => false ) );


Passing the hide_empty parameter would fetch the empty terms from your product category as well.

Leave a Reply

Your email address will not be published. Required fields are marked *