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:

[php]

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

[/php]

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


My name is Mario Peshev, a global SME Business Advisor running digital businesses for 20 the past years.

Born in Bulgaria, Europe, I gained diverse management experience through my training work across Europe, North America, and the Arab world. With 10,000+ hours in consulting and training for organizations like SAP, VMware, CERN, I’ve dedicated a huge amount of my time to helping hundreds of SMEs growing in different stages of the business lifecycle.

My martech agency DevriX grew past 50 people and ranks as a top 10 WordPress global agency and Growth Blueprint, my advisory firm, has served 400+ SME founders and executives with monthly ongoing strategy sessions.


Follow me at:

Latest Editions:

Browse by Category

Latest Answers: