Force categories widget to display empty categories

As you may already know the wordpress categories widget does not provide the option to display empty categories. Adding this snippet to the functions.php of your wordpress theme will force the categories widget to display empty categories.

 

 

<?php
add_filter( 'widget_categories_args', 'force_widget_cat_args' );
function force_widget_cat_args($cat_args) {
$cat_args['hide_empty'] = 0;
return $cat_args;
}
?>

Leave a comment