Categories widget show empty?

Not sure what you mean by ‘display all categories’, i thought it does that by default?

Anyways…you can hook into it, using the following filter hooks:

  • widget_categories_args
  • widget_categories_dropdown_args

Both hooks pass the query args to get the categories as an array.

The default is array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h), wherein $c and $h are booleans and represent if the user selected ‘Show post counts’ and ‘Show hierarchy’ in the widget’s options, respectively.

The dropdown version gets another value: $cat_args['show_option_none'] = __('Select Category');, setting the label for the ‘none selected’ state.

You’ll can hook the same callback to both filters, so that the result is the same no matter if Show as dropdown is selected or not.

BTW: The widgets that come with WP out of the box are defined in wp-includes/default-widgets.php, the code in there is quite readable.