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 );
Related Posts:
- How To Find Out WordPress Category Table in MYSQL?
- Add custom field to Category
- Get current category details the user is currently on in category.php
- Does the ‘cat’ argument in query_posts fetch posts from subcategories as well as the given ID?
- Get Default Post Category From Settings
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Display list of Sub-Categories and the posts they contain, within one main Category
- Create subdomains for tags and categories
- Categories – create a new separate set right after the default?
- How to get this only in small letters (lowercase)? [closed]
- How to totally get rid of Category in my blog?
- Is there a function to cause empty categories not to show in menus?
- Category Specific Archive
- How to select product category while adding new product in woocommerce? [closed]
- How do I count how many top level categories there are?
- How to get the number of child categories a specific parent category has?
- Removing category base form links messes up the parent-child behavior
- display most popular tags of category?
- Exclude category from loop not working
- How to list only child categories?
- Want to hide some categories from the categories meta box in the post editor for the two specific user roles
- Getting categories id for all products in cart
- Cannot add / edit categories to a post anymore
- List archived posts by subcategory
- What’s the Simplest Way to Override/Rewrite the %category% Permalink Structure Tag?
- Show Different Custom Menu on Different Category Pages
- Set a them for all subset of category
- Show archives by year from just one category
- How to query post like normal search would do. within search.php page
- How to get the id from the custom category?
- Combining post categories and link categories?
- Category being displayed without base parmalink
- wordpress sub-category ( lowercase letters + non-latin characters ) = 404
- Unwanted Duplicate Product Categories in WooCommerce
- WP didn’t redirect to canonical category URL
- Customize WordPress widget – Product Category
- Display categories with child category separated by letter
- WP admin broken. Not saving catgories or adding categories to menu
- Set colors depending on category
- get_terms function not returning anything
- Getting All Post From Specific category in wpdb
- Single.php Category Post Count
- Jigoshop – only displaying 10 products
- Is there a way to only show Custom Meta Data on single posts from certain catagories
- Show the amount of posts in a tag in a specific category has
- display a widget on specific category and its sub categories
- Custom page category taxonomy 404
- How to hide category
- Show 10 Sub Categories Per Parent Category Page?
- Conditional category & tag statement
- How to remove the category from post slug
- How to display posts from specific category using get_option function?
- Assign a custom post to a custom taxonomy based on custom field value
- How can i show categories of custom post
- Posts of specific category on page and excluded from index.htm
- How can assign posting to Subscriber to specific category?
- Is there any better/faster code than this ? It shows the categories that an author had ever posted in
- How to show only child categories using the_category();
- Exclude posts without category from loop
- remove url from categories
- how to style show_count in wp_list_categories()
- Why in the e-mail notification about a new post published, the category of the post is always: Uncategorized
- Page category filter in admin dashboard
- How to get immediate children of a ‘term’ parent id through ‘get_terms’?
- Identify a single category and output some code on an archive page
- Remove WP Core canonical for category pagination
- in post content shortcode works, but hardcoded in same page template doesn’t?
- front end add category to new post
- how to display specific Category if post have more one Category?
- Only 10 of 233 categories selectable when adding a new post
- When creating category, it creates automatically tag, or, when creating tag, it creates automatically category in same name
- Is there a way to fetch the category of a page when using wp_list_pages?
- How to fix 404 error in pagination in categories of woocommerce with common url base /shop/?
- How to delete WooCommerce categories in bulk that only have one product
- Product Category page showing all products
- List posts from a category and embed them into a page
- Print categories and most viewed articles
- Get category of a taxonomy for a queries object in a loop
- ACF Gallery with Media Categories – how do display categories and sort
- Loop within category’s posts
- How to remove specific categories from tag archives?
- WordPress edit.php category filter to show only posts from direct category and not posts from it child category
- How can I just show portfolio items from 1 category on portfolio page?
- How to add a new child category via an SQL statement?
- How can I allow people to ‘subscribe’ to categories?
- Several loop in search result
- categories and sub-categories of posts are wrongly saved in DB
- get_category_parents displays an empty category
- Link categories to last post
- wp_list_categories not working on my live site
- Recent posts in current category?
- Sort categories by meta value
- How can I offer different RSS-Feeds by category?
- Printing out Main Category ID’s in a Loop
- Getting lots of errors with sitemap on google webmasters
- Not able to display category link and name [closed]
- How can i hide the authors box from a specific set of categories and post types?
- How to list out post category name and description in page
- Print child category slug nicename
- CPT Custom post type Tags & Categories not showing for ‘Editor’ user in editor