0

I have added tags to my custom post type and by default the tag meta box appears under the 'publish' meta box on the right. I can manually drag the meta box to reposition it under the rest of my meta boxes on the left but this is inefficient in deployment.

How can I position the default tags meta box using code like the rest of my meta boxes?

add_action( 'admin_init', 'admin_boxes' );
function admin_boxes()
{
    add_meta_box( 'display_text_meta_box',
        'Text box',
        'display_text_meta_box',
        'custom_types', 'normal', 'high'
    );
}

function display_text_meta_box( $custom_type ) 
{

}
3
  • 1
    Are you searching for something like this or like this?
    – kaiser
    Oct 29, 2014 at 12:05
  • I used the plugin to disable the meta box order along with @Bainterents answer, but it still displays under the publish meta box...
    – myol
    Oct 29, 2014 at 12:19
  • Myol, please take some time at the help center to see how the system works. Bainternet does not get your ping. You will need to comment on his answer ... sigh
    – kaiser
    Oct 29, 2014 at 12:22

1 Answer 1

4

You can remove the default post tags metabox and then add it again in the desired location, ex:

add_action( 'add_meta_boxes', 'move_tags_metabox_location', 0 );
function move_tags_metabox_location(){
    global $wp_meta_boxes;
    unset( $wp_meta_boxes['post']['side']['core']['tagsdiv-post_tag'] );
    add_meta_box( 'tagsdiv-post_tag', 'Tags', 'post_tags_meta_box', 'post', 'normal', 'core', array( 'taxonomy' => 'post_tag' ));
}
2
  • is it critical to use unset? I can get this to work with just add_meta_box
    – myol
    Oct 29, 2014 at 12:50
  • it's already added so the unset is crucial.
    – Bainternet
    Oct 30, 2014 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.