Make WordPress Core

Ticket #20930: 20930.patch

File 20930.patch, 2.3 KB (added by ocean90, 12 years ago)
  • wp-includes/taxonomy.php

     
    323323                                                'query_var' => $taxonomy,
    324324                                                'public' => true,
    325325                                                'show_ui' => null,
     326                                                'show_in_menu' => null,
    326327                                                'show_tagcloud' => null,
    327328                                                '_builtin' => false,
    328329                                                'labels' => array(),
     
    359360                add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
    360361        }
    361362
    362         if ( is_null($args['show_ui']) )
     363        // If not set, default to the setting for public.
     364        if ( null === $args['show_ui'] )
    363365                $args['show_ui'] = $args['public'];
    364366
     367        // If not set, default to the setting for show_ui.
     368        if ( null === $args['show_in_menu'] || ! $args['show_ui'] )
     369                $args['show_in_menu'] = $args['show_ui'];
     370
    365371        // Whether to show this type in nav-menus.php. Defaults to the setting for public.
    366372        if ( null === $args['show_in_nav_menus'] )
    367373                $args['show_in_nav_menus'] = $args['public'];
    368374
    369         if ( is_null($args['show_tagcloud']) )
     375        // If not set, default to the setting for show_ui.
     376        if ( null === $args['show_tagcloud'] )
    370377                $args['show_tagcloud'] = $args['show_ui'];
    371378
    372379        $default_caps = array(
  • wp-admin/menu.php

     
    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' );
     
    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" );