Support » Requests and Feedback » Do NOT Put checked cats on top

  • Is there a way to force the admin to display the categories just like when your adding a new post without reordering them?

    If you have some type of hierarchy, it completely screws up the editing since you can have more than one subcategory with the same name.

    For example:

    – Windows
    — Hardaware
    — Software
    – Macintosh
    — Hardware
    — Software
    – Linux
    — Hardware
    — Software

    I know that it is related to the function wp_category_checklist and the walker but I can’t think of a way to fixing it without editing the core and I really dont see why wordpress is forcing to change the hierarchy if all the parent category and so on is part of the core since I can remember.

Viewing 3 replies - 1 through 3 (of 3 total)
  • While I don’t recommend hacking core, this is a quick fix for what you need. Mentioned line numbers are specific to WP 2.8.4

    wp-admin/includes/template.php lines 522:532

    foreach( $keys as $k ) {
    	if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
    		$checked_categories[] = $categories[$k];
    		// comment out this --> unset( $categories[$k] );
    // Put checked cats on top
    // comment out this --> echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
    // Then the rest of them
    echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));

    Hope that helps.

    That really helped, thank you! It would be nice if this became a setting in WP’s admin. When using (lots of) parent/child categories, it becomes quite a mess when WP moves the selected ones to the top…

    Agreed @marko_j. I’m working on a custom magazine WP instance at the moment and this really seemed more of a flaw then a feature (at least for our use). I’ve yet to check out 2.8.5 but don’t assume this would have been addressed as there are better fish to fry.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Do NOT Put checked cats on top’ is closed to new replies.