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:
<?php
$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' );
?>
<ul>
<li><a href="<?php echo esc_url( $all_posts_url ); ?>">Show All</a></li>
<?php wp_list_categories( $list_cat_args ); ?>
</ul>
post_type
isn't and argument supported bywp_list_categories