Make WordPress Core

Ticket #20930: 20930.diff

File 20930.diff, 2.5 KB (added by wonderboymusic, 11 years ago)
  • wp-admin/menu.php

    diff --git wp-admin/menu.php wp-admin/menu.php
    index 365b459..497a89a 100644
    $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu 
    6565        /* translators: add new file */
    6666        $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
    6767        foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
    68                 if ( ! $tax->show_ui )
     68                if ( ! $tax->show_ui || ! $tax->show_in_menu  )
    6969                        continue;
    7070
    7171                $submenu['upload.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=attachment' );
    foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 
    126126
    127127        $i = 15;
    128128        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
    129                 if ( ! $tax->show_ui || ! in_array($ptype, (array) $tax->object_type, true) )
     129                if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array( $ptype, (array) $tax->object_type, true ) )
    130130                        continue;
    131131
    132132                $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );
  • wp-includes/taxonomy.php

    diff --git wp-includes/taxonomy.php wp-includes/taxonomy.php
    index 955369e..8d918f5 100644
    function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 
    326326                'query_var' => $taxonomy,
    327327                'public' => true,
    328328                'show_ui' => null,
     329                'show_in_menu' => null,
    329330                'show_tagcloud' => null,
    330331                '_builtin' => false,
    331332                'labels' => array(),
    function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 
    363364                add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
    364365        }
    365366
    366         if ( is_null($args['show_ui']) )
     367        // If not set, default to the setting for public.
     368        if ( null === $args['show_ui'] )
    367369                $args['show_ui'] = $args['public'];
    368370
     371        // If not set, default to the setting for show_ui.
     372        if ( null === $args['show_in_menu'] || ! $args['show_ui'] )
     373                $args['show_in_menu'] = $args['show_ui'];
     374
    369375        // Whether to show this type in nav-menus.php. Defaults to the setting for public.
    370376        if ( null === $args['show_in_nav_menus'] )
    371377                $args['show_in_nav_menus'] = $args['public'];
    372378
    373         if ( is_null($args['show_tagcloud']) )
     379        // If not set, default to the setting for show_ui.
     380        if ( null === $args['show_tagcloud'] )
    374381                $args['show_tagcloud'] = $args['show_ui'];
    375382
    376383        $default_caps = array(