WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of main categories for a set of products. All these products has additional taxonomies associated with them.

On a product category page, is there a way I can get all terms in use for that particular category?

I believe it can be done by looping through all products, but that seems a bit convoluted…

share|improve this question

You probaby want get_terms().

WordPress keeps a count of the number of posts that use a taxonomy and you can filter your query using it:

// get all the terms in the 'category' taxonomy
$terms = get_terms('knife');
// list all the terms that have at least one post
foreach ($terms as $term) {
    echo "{$term->name} has {$term->count} posts."
share|improve this answer
This gives me all terms in use for the 'category' taxonomy. I want to have all terms in use for that particular taxonomy term, for example 'knife'. – vorpyg Nov 17 '12 at 16:50
Yes, change the parmeter 'category' to 'knife' ... – totels Nov 17 '12 at 17:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.