By default the WordPress category widget does not show empty categories. Today i will show you how to display empty categories in WordPress widgets.
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.
I went over this site and I conceive you have a lot of wonderful information, bookmarked . ebgecaecagag