Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'meta_boxes', 'do_my_meta_boxes' );
- function do_my_meta_boxes( $post_type ) {
- remove_meta_box( 'my_taxonomydiv', $post_type, 'side' );
- add_meta_box( 'my_taxonomydiv', 'My Taxonomy', 'my_meta_box', $post_type, 'side' );
- }
- function my_meta_box( $post, $meta_box ) {
- $taxonomy = 'my_taxonomy';
- $tax = get_taxonomy( $taxonomy );
- $selected = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
- ?>
- <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
- <input type="hidden" name="tax_input[<?php echo $taxonomy; ?>][]" value="0" />
- <ul id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy; ?> categorychecklist form-no-clear">
- <?php
- wp_terms_checklist( $post->ID, array(
- 'taxonomy' => $taxonomy,
- 'selected_cats' => $selected
- ) );
- ?>
- </ul>
- </div>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement