Force WordPress to show empty categories

Category widget is, like many other features in WordPress, optimized for better user experience and website performance. That means that there are functions integrated to make WordPress smarter.

When it comes to categories, default WordPress settings will tell your system not to show empty categories. So, if you have created a category but haven’t put any posts in it, the widget simply won’t display the category on the list.

But what if you are just starting and really want to show categories to let people know what they can expect in the future? Just as an example, you might have planned to have “movie reviews” category and already have it on your site, but if you haven’t assigned a post to it, your “movie reviews” simply won’t show on the list.

Instead of creating a dummy post just in order to show category on the list, you can easily change that and force WordPress (or politely ask him to do so by using your new code) to show all categories. There is high number of parameters available which you can include into wp list categories code, but for now, you only need to worry about one – “hide_empty” argument:

    1. Open functions.php
    2. Copy and paste the following code:
add_filter( 'widget_categories_args', 'mytheme_widget_cat_args' );
function mytheme_widget_cat_args($cat_args) {
$cat_args['hide_empty'] = 0;
return $cat_args;
  1. Save changes

Now you can go on and check your categories widget. As you may notice, there are now all categories, including those without posts, listed in your widget.

If you want to modify the WP list categories, you can modify the code to change any of the default settings. Check the list of parameters and edit them accordingly.


This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

Your email address will not be published. Required fields are marked *