How to show empty categories in WordPress category widget

By default, WordPress does not display empty categories in default category widget. But, you can easily fix this issue by adding the following code snippet to your functions.php file located inside your theme directory. The following code will force the WordPress category widget to display empty categories.

Quick Tip : Hide specific categories from WordPress category widget

//Show empty categories in category widget
add_filter('widget_categories_args','show_empty_categories');
function show_empty_categories($cat_args){
	$cat_args['hide_empty'] = 0;
	return $cat_args;
}

 

Force categories widget to display empty categories

Force categories widget to display empty categories

0 Comments

Leave a Comment.