This problem is affecting me as well, beginning to search for where the problem is. This is just my efforts to probe inside core WordPress and perhaps the info may help. All references are based on WP 2.7.1 version code:
- /wp-admin/categories.php at line 209 calls:
<?php
cat_rows(0, 0, 0, $pagenum, $catsperpage);
?>
- /wp-admin/includes/template.php at line 23 creates the internalized version of this function:
function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
$count = 0;
_cat_rows($categories, $count, $parent, $level, $page, $per_page);
}
- The internalized function just below in template.php calls get_categories on line 46:
$categories = get_categories( $args );
- get_categories function is in /wp-includes/category.php starting on line 39 and is reasonably documented at get_categories Codex page.
At this point I did some variable output tests to see the arguments being passed to different instances of get_categories:
Output from the category parent drop-down list (which seems to show entire tree structure and nested levels properly):
Array ( [type] => category [show_option_all] => [show_option_none] => None [orderby] => name [order] => ASC [show_last_update] => 0 [show_count] => 0 [hide_empty] => 0 [child_of] => 0 [exclude] => [echo] => 1 [selected] => 0 [hierarchical] => 1 [name] => category_parent [class] => postform [depth] => 0 [tab_index] => 0 [include_last_update_time] => 0 )
Output from the category list which is where we are having our problems:
Array ( [type] => category [hide_empty] => 0 )
The difference being that the drop-down calls get_categories by way of wp_dropdown_categories instead of cat_rows. Here’s the relevant portion of wp_dropdown_categories from /wp-includes/category-template.php/ starting on line 370:
function wp_dropdown_categories( $args = '' ) {
$defaults = array(
'show_option_all' => '', 'show_option_none' => '',
'orderby' => 'ID', 'order' => 'ASC',
'show_last_update' => 0, 'show_count' => 0,
'hide_empty' => 1, 'child_of' => 0,
'exclude' => '', 'echo' => 1,
'selected' => 0, 'hierarchical' => 0,
'name' => 'cat', 'class' => 'postform',
'depth' => 0, 'tab_index' => 0
);
$r = wp_parse_args( $args, $defaults );
$categories = get_categories( $r );
More to come…..