[wp-trac] [WordPress Trac] #42765: Add the filter to the taxonomy metabox when editing a post

WordPress Trac noreply at wordpress.org
Fri Dec 1 10:41:17 UTC 2017


#42765: Add the filter to the taxonomy metabox when editing a post
----------------------------+-----------------------------
 Reporter:  mihdan          |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Taxonomy        |    Version:  4.9.1
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 The filter (`default_term_id`) is needed to set a default term in the
 custom taxonomy for custom post type.
 File: '''/wp-admin/includes/meta-boxes.php''', Line: 542

 {{{
 <div id="<?php echo $tax_name; ?>-all" class="tabs-panel">
     <?php
     $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' .
 $tax_name . ']';
     echo "<input type='hidden' name='{$name}[]' value=' . apply_filters(
 'default_term_id', 0, tax_name ) . ' />"; // Allows for an empty term set
 to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
     ?>
     <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php
 echo $tax_name; ?>" class="categorychecklist form-no-clear">
         <?php wp_terms_checklist( $post->ID, array( 'taxonomy' =>
 $tax_name, 'popular_cats' => $popular_ids ) ); ?>
     </ul>
 </div>
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42765>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list