By default, WordPress does not display empty categories in the category widget, but there are times when, especially as a developer, you need to display categories, even if they are “still” empty.
Well, it’s very easy to get categories to display in the widget, just add this code to your theme’s functions.php file or your customizations plugin:
/* Show empty categories in widget */
add_filter( 'widget_categories_args', 'wphelp_show_empty_categories' );
function wphelp_show_empty_categories($cat_args) {
$cat_args['hide_empty'] = 0;
return $cat_args;
}
Code language: PHP (php)
When you save the changes you’ll go from this…

To this.

Read this post in Spanish: Cómo mostrar categorías vacías en el widget de categorías
Thanks!
Is it also possible to add a class to the category when it’s empty?