List all Product Categories
-
Hi,
I am trying to get a list of all product categories into an array for something on my main page, but none of what I have tried is working – the array is always empty with zero elements.
These return an empty array:
get_terms(‘product_cat’);
get_categories(array(‘taxonomy’ => ‘product_cat’));But if I change the taxonomy like so:
get_terms(‘product_type’);Then the product_type taxonomy terms are listed.
I did notice in the MySQL database that all rows with taxonomy of ‘product_cat’ in the term_taxonomy table have the value zero in the count column, which might give some explanation, but in all other respects the site is functioning correctly – when I navigate to a category the correct products are listed.
So I am bit stuck and would like some help and ideas.
Thanks,
Paul
The topic ‘List all Product Categories’ is closed to new replies.