Make WordPress Core


Ignore:
Timestamp:
01/11/2010 07:27:44 PM (17 years ago)
Author:
ryan
Message:

Show custom hierarchical taxonomies in the menus. Props dd32. see #11838

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/menu.php

    r12673 r12694  
    4848        $i = 15;
    4949        foreach ( $wp_taxonomies as $tax ) {
    50                 if ( $tax->hierarchical || ! in_array('post', (array) $tax->object_type, true) )
     50                if ( ! in_array('post', (array) $tax->object_type, true) )
    5151                        continue;
    5252
    53                 $submenu['edit.php'][$i] = array( esc_attr($tax->label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax->name );
     53                if ( $tax->hierarchical )
     54                        $submenu['edit.php'][$i] = array( esc_attr($tax->label), 'manage_categories', 'categories.php?taxonomy=' . $tax->name );
     55                else
     56                        $submenu['edit.php'][$i] = array( esc_attr($tax->label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax->name );
    5457                ++$i;
    5558        }
    56 
    57         $submenu['edit.php'][50] = array( __('Categories'), 'manage_categories', 'categories.php' );
    5859
    5960$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top', 'menu-media', 'div' );
    … …  
    8788        $i = 15;
    8889        foreach ( $wp_taxonomies as $tax ) {
    89                 if ( $tax->hierarchical || ! in_array($ptype, (array) $tax->object_type, true) )
     90                if ( ! in_array($ptype, (array) $tax->object_type, true) )
    9091                        continue;
    9192
    92                 $submenu["edit.php?post_type=$ptype"][$i] = array( esc_attr($tax->label), 'manage_categories', "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );
     93                if ( $tax->hierarchical )
     94                        $submenu["edit.php?post_type=$ptype"][$i] = array( esc_attr($tax->label), 'manage_categories', "categories.php?taxonomy=$tax->name&post_type=$ptype" );
     95                else
     96                        $submenu["edit.php?post_type=$ptype"][$i] = array( esc_attr($tax->label), 'manage_categories', "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );
    9397                ++$i;
    9498        }
Note: See TracChangeset for help on using the changeset viewer.