I have a wp_list_categories list set to display my custom taxonomy.

Everything works fine, and now I want to add a show_option_all link.

However, when the link is clicked it displays all default post type posts and none of the custom taxonomy. Obviously, the intent is to display all of the posts in this taxonomy, and only those.

$args = array('post_type' => 'design_asset', 'show_count' => 1, 'taxonomy' => 'asset_type', 'show_option_all' => 'Show All');

Can this work? How?

  • post_type isn't and argument supported by wp_list_categories
    – Tomás Cot
    Commented Aug 20, 2014 at 20:01
  • Yes, but the category list is correctly displaying the number of custom posts with the taxonomy and clicking the link correctly filters them. All that doesn't work is the show all.
    – Steve
    Commented Aug 20, 2014 at 20:05

1 Answer 1


wp_list_categories() is an odd function in that it's uniquely useful in certain situations with custom taxonomies but it was originally written before they even existed. (It was introduced in 2.1 and the taxonomy attribute was added in 3.0 (source).)

What you're seeing is a known issue with an associated bug report (filed two years ago, last activity four months ago). If you look at the source, you can see that the link is hard-coded to go to the page_for_posts page. So for now, you're looking for a work-around.

As @tomas-cot notes in their comment, the post_type argument in your code snippet isn't a valid argument for wp_list_categories(). However, I think what you're intending is for the show_option_all link to go the Post Type Archive page of your CPT.

You could do this with a walker class or maybe hacking the title_li argument, but since you have to wrap the function in <ul> tags anyway, I'd recommend the following (untested) code:

$list_cat_args = array(
    'show_count' => 1,
    'taxonomy' => 'asset_type',
    'use_desc_for_title' => 0 /* title attr bad for accessibility! */
// get the post type archive link
$all_posts_url = get_post_type_archive_link( 'design_asset' );
    <li><a href="<?php echo esc_url( $all_posts_url ); ?>">Show All</a></li>
    <?php wp_list_categories( $list_cat_args ); ?>
  • It barfs on post_type_archive_link; it should have been get_post_type_archive_link. Otherwise, it works, thank you.
    – Steve
    Commented Aug 21, 2014 at 13:06
  • Only issue is I would need the all_posts_url to be the taxonomy archive page, not the post type archive page. I found get_term_link but I had some questions about how to use this in my case...
    – Steve
    Commented Aug 21, 2014 at 17:03
  • There isn't an archive page for an entire taxonomy, there are only archives for taxonomy terms and post types. I suspect the post type archive is the closest you can get.
    – mrwweb
    Commented Aug 21, 2014 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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