Does a hook exist that would allow one to enhance the widget options for the category widget in order to allow setting the default sort order?

Also, I notice in the codex the options for sort appear to be one of any of these (id, name, slug, count, group) and either ascending or descending. So, Ideally a drop down menu on widget options panel to allow one to set those two parameters (order and orderby) is what I'm looking to do.

Otherwise, I'll just filter wp_list_categories and add the order option to my theme options, but it seems more logical to put it on the widget control itself.

PS: I can't seem to ever get done with enhancements to WordPress categories. I hope there's more work done on core category options in the future. Especially with the emergence of site theming and soloing of late. I know WP is ahead of most publishing systems in terms of its early support for categories, but it seems they've left lots on the table after that.

1 Answer 1


Hi @Scott B:

From /wp-includes/widgets.php for the WP_Category_Widget class we have the following code (line 438 in WordPress v3.0.4):

$cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);
if ( $d ) {
  $cat_args['show_option_none'] = __('Select Category');


From that I would surmise the hook 'widget_categories_dropdown_args' should allow you to set an 'orderby' parameter?

P.S. Have you ever considered using (something like) PhpStorm? As you ask lots of "How can I get access to..." kind of questions you'd probably find yourself an order of magnitude more productive if you had a tool like PhpStorm that could quickly get you these answers. Just a thought...

  • Thanks as always. And thanks for the tip on PhpStorm. I'll definitely check it out.
    – Scott B
    Jan 30, 2011 at 1:55
  • @Scott B: Is the answer what you needed? Jan 30, 2011 at 2:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.