I have 2 custom post types and custom taxonomy assigned to both post types.

On the page where I list posts (custom post type archive page) I would like to dispay a list of all custom taxonomy terms that are assigned to posts in this post type.

I did this with wp_list_categories but it lists ALL terms and not just the ones populated with posts from this post type.

function taxonomy_term_list() {
    $taxonomy     = 'my_taxonomy';
    $orderby      = 'name';
    $show_count   = 1;
    $pad_counts   = 1;
    $hierarchical = 1;
    $title        = '';
    $empty        = 1;

    $args = array(
        'taxonomy'     => $taxonomy,
        'orderby'      => $orderby,
        'show_count'   => $show_count,
        'pad_counts'   => $pad_counts,
        'hierarchical' => 1,
        'title_li'     => $title,
        'hide_empty'   => $empty

    echo wp_list_categories( $args );


Is there any way I can pass post_type argument here?


Yo might want to have a look at this post:

You can include the empty terms by passing 'hide_empty' => 0,.

  • Solution on link seems to output also terms that have posts from other post type. I just need to have a list of terms that have posts in this post type. – klox7 May 18 '16 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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