You may often get confused why the entire category list of your WordPress blog does not appear on blog sidebar. When you double check your widget section and see that you have properly added “Categories” widget with correct settings, you may get a bit worried thinking something is wrong with your blog!

Well do not panic, WordPress hide empty categories by default. It does not show the categories with zero post. But sometimes you may need to show all the categories even you have no post in them to give the readers an idea of the range of categories exists on the blog where those empty categories will be filled with potential posts in future. To accomplish this, you need to add the following piece of code into your current active theme’s function.php file.

add_filter( 'widget_categories_args', 'wpb_force_empty_cats' );
function wpb_force_empty_cats($cat_args) {
$cat_args['hide_empty'] = 0;
return $cat_args;
}

You may do this in many different ways. One of the easiest process is to make the changes through your WordPress dashboard. Simply follow the steps below:

  • Go to Appearance > Editor
  • Click on “Theme Functions (functions.php)” file on the right side.
  • Put the piece of code from above and click on “update file” button.

And you are done! Now check the list of categories on your blog sidebar. You should now see full list of categories including empty ones.

Leave a Reply

4 responses to “Show Empty Categories in WordPress Widgets”

  1. I’m not sure where you’re getting your info, but great topic.
    I needs to spend some time learning more or understanding more.
    Thanks for great information I was looking for this info for my mission.

  2. Hello i am kavin, its my first occasion to commenting anywhere, when i read
    this piece of writing i thought i could also make comment due to this brilliant article.

Leave a Reply

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