Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is actually a three-part question.

1.) How do I get list all terms of my custom taxonomy (in this case, 'audiocat')?

2.) How do I display the count of each term? Example:

Rock (5)
Pop (3)

3.) How do I sort them according to their parent? Example:

Rock (5)
  Subcategory (3)
Pop (3)
  Sub category (1)

So far, I can get the list of all the terms from 'audiocat' but if they have more than one content, then it duplicates it. So I can't proceed to my second problem.

Here's how I query them:

$audio = get_posts( array (
    'paged' => get_query_var('paged'),
    'post_type' => 'audio',
    'posts_per_page' => 10,
    'order' => 'ASC',
    'orderby' => 'meta_value',
    'taxonomy' => 'audiocat',
share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.