Make WordPress Core

Changeset 25133


Ignore:
Timestamp:
08/26/2013 10:34:56 PM (11 years ago)
Author:
ocean90
Message:

Introduce show_in_menu for register_taxonomy.

Accepts boolean: true to show, false to hide. If not set, the default is inherited from show_ui.

fixes #20930.

Location:
trunk/src
Files:
3 edited

Legend:

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

    r25100 r25133  
    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
     
    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
     
    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
     
    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
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r24917 r25133  
    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 );
  • trunk/src/wp-includes/taxonomy.php

    r25130 r25133  
    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.
     
    325330        'hierarchical'          => false,
    326331        'show_ui'               => null,
     332        'show_in_menu'          => null,
    327333        'show_in_nav_menus'     => null,
    328334        'show_tagcloud'         => null,
     
    366372    if ( null === $args['show_ui'] )
    367373        $args['show_ui'] = $args['public'];
     374
     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'];
    368378
    369379    // If not set, default to the setting for public.
Note: See TracChangeset for help on using the changeset viewer.