Latest Tech and Tips

How to Show Empty Categories in WordPress Widgets


By default the WordPress classification widget does disappoint empty categories. Recently a brand-new individual asked us if it was feasible to present empty categories in WordPress widget to assist with his neighborhood growth. In this write-up, we will certainly show you how to present empty categories in WordPress widgets.

Display empty categories inside categories widget

First point you require to do is include this basic code fragment in your kid style’s functions.php data or a website details plugin.

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

This code links our custom-made feature wpb_force_empty_cats to widget_categories_args filter. Inside our feature we have actually changed the choice hide_empty and also establish it to incorrect.

That’s all, you can currently drag and also go down categories widget to any type of sidebar or widget all set location on your WordPress website. The classification widget will certainly currently present empty categories also.

If you’re working with a neighborhood growth atmosphere, after that we advise that you include some dummy material to your web site for screening objectives.

Also do not neglect to take a look at our overview on how categories and also tags job in WordPress.

If you liked this write-up, after that subscribe to our YouTube Channel for even more WordPress video clip tutorials. You can likewise discover us on Twitter and also Google+.