Make WordPress Core

Ticket #14206: 14206.2.diff

File 14206.2.diff, 3.7 KB (added by helen, 12 years ago)
  • wp-includes/taxonomy.php

     
    289289 *     * If not set, the default is inherited from public.
    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.
    294296 * - rewrite - Triggers the handling of rewrites for this taxonomy. Defaults to true, using $taxonomy as slug.
     
    332334                'show_in_menu'          => null,
    333335                'show_in_nav_menus'     => null,
    334336                'show_tagcloud'         => null,
     337                'meta_box_cb'           => null,
    335338                'capabilities'          => array(),
    336339                'rewrite'               => true,
    337340                'query_var'             => $taxonomy,
     
    404407        $args['labels'] = get_taxonomy_labels( (object) $args );
    405408        $args['label'] = $args['labels']->name;
    406409
     410        // If not set, use the default meta box
     411        if ( null === $args['meta_box_cb'] ) {
     412                if ( $args['hierarchical'] ) {
     413                        $args['meta_box_cb'] = 'post_categories_meta_box';
     414                } else {
     415                        $args['meta_box_cb'] = 'post_tags_meta_box';
     416                }
     417        }
     418
    407419        $wp_taxonomies[ $taxonomy ] = (object) $args;
    408420
    409421        // register callback handling for metabox
  • wp-includes/post.php

     
    11391139 * - map_meta_cap - Whether to use the internal default meta capability handling. Defaults to false.
    11401140 * - supports - An alias for calling add_post_type_support() directly. Defaults to title and editor.
    11411141 *     * See {@link add_post_type_support()} for documentation.
    1142  * - register_meta_box_cb - Provide a callback function that will be called when setting up the
    1143  *     meta boxes for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback.
     1142 * - register_meta_box_cb - Provide a callback function that sets up the meta boxes
     1143 *     for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback.
    11441144 * - taxonomies - An array of taxonomy identifiers that will be registered for the post type.
    11451145 *     * Default is no taxonomies.
    11461146 *     * Taxonomies can be registered later with register_taxonomy() or register_taxonomy_for_object_type().
  • wp-admin/edit-form-advanced.php

     
    140140
    141141// all taxonomies
    142142foreach ( get_object_taxonomies( $post ) as $tax_name ) {
    143         $taxonomy = get_taxonomy($tax_name);
     143        $taxonomy = get_taxonomy( $tax_name );
    144144        if ( ! $taxonomy->show_ui )
    145145                continue;
    146146
    147147        $label = $taxonomy->labels->name;
    148148
    149         if ( !is_taxonomy_hierarchical($tax_name) )
    150                 add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name ));
     149        if ( ! is_taxonomy_hierarchical( $tax_name ) )
     150                $tax_meta_box_id = 'tagsdiv-' . $tax_name;
    151151        else
    152                 add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name ));
     152                $tax_meta_box_id = $tax_name . 'div';
     153
     154        add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) );
    153155}
    154156
    155157if ( post_type_supports($post_type, 'page-attributes') )