• I just found this problem last night after updated to version 2.7, the Category list report on a new admin theme was error! one of the category name on the 3rd level has lost! But on the “Category Parent” drop-down menu are stills. How could it be like this?

    Please see the attaches below, the missing one is name “GT RADIAL TBR”
    -Category Drop-Down Menu
    -Category Display List

Viewing 5 replies - 1 through 5 (of 5 total)
  • Same problem here. If you come up with a solution, please let me know.

    Thread Starter bonkerboy

    (@bonkerboy)

    so, no one have a solution yet?

    Jamie O

    (@idealien)

    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…..

    Jamie O

    (@idealien)

    Based on my last post and experimenting with the arguments passed from the function (cat_rows) which is called in generating the table of categories, I have a “working solution” for those who are affected by this problem.

    NOTE: This is very much a short-term solution for those noticeably affected by this problem – use at your own risk!

    • Find and comment out the following code on line 43 of /wp-admin/includes/template.php
      $args = array('hide_empty' => 0);
    • Replace it with the following code:
      $args = array('orderby' => 'ID', 'order' => 'ASC','hide_empty' => 0, 'child_of' => 0, 'depth' => 0);

    I would hope someone more intimitely familiar with the backend code of WordPress will follow-up on this. There are quite probably more better ways to resolve this based on what the functions associated are doing throughout the site. But I’d like to think that I’ve helped the conversation enough that a resolution could be put in place for the next release.

    Jamie O

    (@idealien)

    For any developers looking into this – I think this Trac ticket might be related: https://core.trac.www.ads-software.com/ticket/9089

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘(BUG) Category list display mismatch! on V. 2.7’ is closed to new replies.