Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Show Empty Categories in WordPress Widgets

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Show Empty Categories in WordPress Widgets

By default the WordPress category widget does not show empty categories. Recently a new user asked us if it was possible to display empty categories in WordPress widget to help with his local development. In this article, we will show you how to display empty categories in WordPress widgets.

Display empty categories inside categories widget

First thing you need to do is add this simple code snippet in your child theme‘s functions.php file or a site specific plugin.

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

This code hooks up our custom function wpb_force_empty_cats to widget_categories_args filter. Inside our function we have modified the option hide_empty and set it to false.

That’s all, you can now drag and drop categories widget to any sidebar or widget ready area on your WordPress site. The category widget will now display empty categories as well.

If you’re working on a local development environment, then we recommend that you add some dummy content to your website for testing purposes.

Also don’t forget to check out our guide on how categories and tags work in WordPress.

If you liked this article, then subscribe to our YouTube Channel for more WordPress video tutorials. You can also find us on Twitter and Google+.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Faisal says:

    Thanks…Its working fine……!!!

  2. Atilla Boz says:

    Hello and thank you. I tried this and it worked but I found out I was searching for something little different. You know when you set it the way that only one line is shown – when I set it that ways it still doen not show the empty cats. You know what I mean? If yes can you help? :)

    Best wishes from Germany, Cologne

  3. Wojciech Warczakowski says:

    Nice and simple, but I wonder what’s the purpose to show empty categories. Is there any other reason except local development?

  4. Balaji says:

    Nice & Thanks

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.