Make WordPress Core

Ticket #20930: 20930.2.diff

File 20930.2.diff, 3.9 KB (added by ocean90, 11 years ago)
  • src/wp-admin/menu.php

     
    5353
    5454        $i = 15;
    5555        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
    56                 if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )
     56                if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true) )
    5757                        continue;
    5858
    5959                $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
     
    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' );
     
    8484        $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), get_post_type_object( 'page' )->cap->create_posts, 'post-new.php?post_type=page' );
    8585        $i = 15;
    8686        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
    87                 if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) )
     87                if ( ! $tax->show_ui || ! $tax->show_in_menu  || ! in_array('page', (array) $tax->object_type, true) )
    8888                        continue;
    8989
    9090                $submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' );
  • src/wp-includes/class-wp-xmlrpc-server.php

     
    547547                if ( in_array( 'cap', $fields ) )
    548548                        $_taxonomy['cap'] = (array) $taxonomy->cap;
    549549
     550                if ( in_array( 'menu', $fields ) )
     551                        $_taxonomy['show_in_menu'] = (bool) $_taxonomy->show_in_menu;
     552
    550553                if ( in_array( 'object_type', $fields ) )
    551554                        $_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type );
    552555
  • src/wp-includes/taxonomy.php

     
    280280 * - hierarchical - Whether the taxonomy is hierarchical (e.g. category). Defaults to false.
    281281 * - show_ui -Whether to generate a default UI for managing this taxonomy in the admin.
    282282 *     * If not set, the default is inherited from public.
     283 * - show_in_menu - Where to show the taxonomy in the admin menu.
     284 *     * If true, the taxonomy is shown as a submenu of the object type menu.
     285 *     * If false, no menu is shown.
     286 *     * show_ui must be true.
     287 *     * If not set, the default is inherited from show_ui.
    283288 * - show_in_nav_menus - Makes this taxonomy available for selection in navigation menus.
    284289 *     * If not set, the default is inherited from public.
    285290 * - show_tagcloud - Whether to list the taxonomy in the Tag Cloud Widget.
     
    324329                'public'                => true,
    325330                'hierarchical'          => false,
    326331                'show_ui'               => null,
     332                'show_in_menu'          => null,
    327333                'show_in_nav_menus'     => null,
    328334                'show_tagcloud'         => null,
    329335                'capabilities'          => array(),
     
    366372        if ( null === $args['show_ui'] )
    367373                $args['show_ui'] = $args['public'];
    368374
     375        // If not set, default to the setting for show_ui.
     376        if ( null === $args['show_in_menu' ] || ! $args['show_ui'] )
     377                $args['show_in_menu' ] = $args['show_ui'];
     378
    369379        // If not set, default to the setting for public.
    370380        if ( null === $args['show_in_nav_menus'] )
    371381                $args['show_in_nav_menus'] = $args['public'];