The following code works perfectly to show all the categories for a custom post type. However when there are no categories it echos 'No Categories'. How would I remove this?

                    <?php //Category Display for Custom Post type - Video
                    $customPostTaxonomies = get_object_taxonomies('opd-music');
                    if(count($customPostTaxonomies) > 0)

                        foreach($customPostTaxonomies as $tax)

                            $args = array(
                                'orderby' => 'name',
                                'show_count' => 0,
                                'pad_counts' => 0,
                                'hierarchical' => 1,
                                'taxonomy' => $tax,
                                'title_li' => '',
                                'echo' => 0,
                                'style' => 'simple'
                            echo '<span class="sort-button-filter">';    
                            echo  '<a href="';
                            echo $alllink;
                            echo  '">All</a>';
                            echo str_replace( '<br />', '', wp_list_categories( $args ) );
                            echo '</span>';

                    } ?>

2 Answers 2


I believe that what you want is show_option_none

(string) Set the text to show when no categories are listed. Defaults to "No categories".


Proof of concept:

$args = array('include'=>123,'show_option_none'=> '');
wp_list_categories( $args );

This answer is for wordpress site which have language other then english. For me, it is japanese.

The selected answer might be correct for english but its not working for Japanese site because the text for the No category is different i.e. 未分類

The default id for 'No category'/ '未分類' is 1, so we can use.

'exclude'=> '1'


$args = array('exclude'=>1);
wp_list_categories( $args );

Your Answer

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

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