Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can this be achived?

Replace the post count on wp_list_categories with "Has Posts" instead of number and "No Posts" if none.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Add the below in your theme's functions.php. It should work the way you want

function my_list_categories( $output, $args ) {
    $output = str_replace( '(0)', '(No Posts)', $output );
    $output = preg_replace( '/\((\d+)\)/', '(Has Posts)', $output );
    return $output;
add_filter( 'wp_list_categories', 'my_list_categories', 10, 2 );
share|improve this answer
This replaced the post number, but it also changed the post category name. I need it to only replace the "(12)" for example – Shae Oct 1 '13 at 15:34
I have improved the answer, please check. Now it should be fine – Maruti Mohanty Oct 1 '13 at 16:01

Your Answer


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

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