Setting the defaulst position of meta boxes on write post page? (1 post)

  1. hilj
    Posted 5 years ago #


    I'm trying to set a default location for meta boxes on the write post page. I would like to have all of them in one column so that the publish box would be the lowest. Same simple order as a form on a website. The site has many authors I'd like to make their job as straightforward as possible.

    I would need to set the default position for the Publish and Categories boxes.

    I found this topic here http://wordpress.org/support/topic/how-to-change-default-meta-box-locations?replies=6

    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>';

    When I try to modify the upper code to move any other box than the tag box I can't get it to work.

    Also this article is just about what I need but I can't get to work either, on non of the boxes. It removes the boxes but is not adding them back again http://wordpress.stackexchange.com/questions/1390/set-default-admin-screen-options-metabox-order

    Here the code that is not working for me:

    function my_remove_meta_boxes() {
      remove_meta_box('postcustom', 'post', 'core');
      remove_meta_box('commentstatusdiv', 'post', 'core');
    add_action( 'admin_menu', 'my_remove_meta_boxes' );
    //add them back
    function my_add_meta_boxes( $post_type, $post ) {
        if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
            add_meta_box('commentstatusdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');
        if ( post_type_supports($post_type, 'custom-fields') )
            add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, 'normal', 'core');
    add_action( 'add_meta_boxes', 'my_add_meta_boxes' );

    Thanks for your help, it is much appreciated :)

Topic Closed

This topic has been closed to new replies.

About this Topic