Support » Plugins » Hacks » How to change default meta box locations?

  • Resolved IckataNET


    Hi WordPress gurus,

    I am trying to change the Post Tags meta box default location – from “side” to “normal” (actually from the right small column to the bigger left one).

    Here is how I try doing it – firstly remove the meta box, and then re-add it, this time setting “normal” instead of “side”. Here’s the code:

    function customize_meta_boxes() {
    add_action( 'add_meta_boxes', 'my_add_meta_boxes' );
    function my_add_meta_boxes(){
    	add_meta_box('tagsdiv-post_tag', 'Автомобили', 'post_tags_meta_box', 'post', 'normal', 'core', array( 'taxonomy' => 'post_tag' ));

    But the only result I gain is to only remove the meta box. Where am I wrong?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The above will only change the default positions, actual positioning is stored in user meta, which is why you’re not seeing changes when you add the code above..

    Leave the code in place, add a new test user, login as that user and you’ll see the position has changed..

    Also, you might wish to try moving the remove_meta_box call into the add_meta_boxes action just before you add one.. (else the remove might be happening after, which is why you don’t see one – at a guess).




    Hi Mark, thanks for your comment! Unfortunately, the metabox is not hidden – it does not appear at all – even in the Screen Options menu – there’s no checkbox for this metabox which I try to reposition.

    Your suggestion to put remove_metabox() function inside add_meta_boxes rather than in admin_menu also brings no effect 🙁

    No idea why, but doesn’t appear you can remove then add back the very same meta box using the remove and add metabox functions (at least i can’t figure out how to make it work)… However! .. this works…

    add_action( 'add_meta_boxes', 'my_remove_meta_boxes', 0 );
    function my_remove_meta_boxes(){
    	global $wp_meta_boxes;
    	unset( $wp_meta_boxes['post']['side']['core']['tagsdiv-post_tag'] );
    	add_meta_box( 'tagsdiv-post_tag', 'Example title', 'post_tags_meta_box', 'post', 'normal', 'core', array( 'taxonomy' => 'post_tag' ));
    	//print '<pre>';print_r( $wp_meta_boxes['post'] );print '<pre>';

    Hope that helps… 🙂



    This does the trick! Thanks a lot!

    You’re welcome.. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to change default meta box locations?’ is closed to new replies.