Make WordPress Core

Ticket #14206: garyc40-14206.patch

File garyc40-14206.patch, 1.6 KB (added by garyc40, 15 years ago)

there's a patch for that

  • wp-admin/edit-form-advanced.php

    diff --git wp-admin/edit-form-advanced.php wp-admin/edit-form-advanced.php
    index 017a163..5bdb4d2 100644
    foreach ( get_object_taxonomies($post_type) as $tax_name ) { 
    119119
    120120        $label = $taxonomy->labels->name;
    121121
    122         if ( !is_taxonomy_hierarchical($tax_name) )
    123                 add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name ));
    124         else
    125                 add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name ));
     122        if ( !is_taxonomy_hierarchical($tax_name) ) {
     123                $tax_meta_box_id = "tagsdiv-{$tax_name}";
     124        }
     125        else {
     126                $tax_meta_box_id = "{$tax_name}div";
     127        }
     128       
     129        add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_callback, $post_type, 'side', 'core', array( 'taxonomy' => $tax_name ) );
    126130}
    127131
    128132if ( post_type_supports($post_type, 'page-attributes') )
  • wp-includes/taxonomy.php

    diff --git wp-includes/taxonomy.php wp-includes/taxonomy.php
    index 72d387a..3371fc8 100644
    function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 
    356356
    357357        $args['labels'] = get_taxonomy_labels( (object) $args );
    358358        $args['label'] = $args['labels']->name;
     359       
     360        if ( empty( $args['meta_box_callback'] ) ) {
     361                if ( $args['hierarchical'] ) {
     362                        $args['meta_box_callback'] = 'post_categories_meta_box';
     363                } else {
     364                        $args['meta_box_callback'] = 'post_tags_meta_box';
     365                }
     366        }
    359367
    360368        $wp_taxonomies[$taxonomy] = (object) $args;
    361369