Make WordPress Core


Ignore:
Timestamp:
09/23/2013 05:11:09 PM (13 years ago)
Author:
nacin
Message:

Introduce a meta_box_cb argument for register_taxonomy().

The specified callback function is used as the meta box callback for the taxonomy.

props garyc40, helen.
fixes #14206.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r25553 r25572  
    290290 * - show_tagcloud - Whether to list the taxonomy in the Tag Cloud Widget.
    291291 *     * If not set, the default is inherited from show_ui.
     292 * - meta_box_cb - Provide a callback function for the meta box display. Defaults to
     293 *     post_categories_meta_box for hierarchical taxonomies and post_tags_meta_box for non-hierarchical.
    292294 * - capabilities - Array of capabilities for this taxonomy.
    293295 *     * You can see accepted values in this function.
     
    333335                'show_in_nav_menus'     => null,
    334336                'show_tagcloud'         => null,
     337                'meta_box_cb'           => null,
    335338                'capabilities'          => array(),
    336339                'rewrite'               => true,
     
    401404        $args['labels'] = get_taxonomy_labels( (object) $args );
    402405        $args['label'] = $args['labels']->name;
     406
     407        // If not set, use the default meta box
     408        if ( null === $args['meta_box_cb'] ) {
     409                if ( $args['hierarchical'] )
     410                        $args['meta_box_cb'] = 'post_categories_meta_box';
     411                else
     412                        $args['meta_box_cb'] = 'post_tags_meta_box';
     413        }
    403414
    404415        $wp_taxonomies[ $taxonomy ] = (object) $args;
Note: See TracChangeset for help on using the changeset viewer.