Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Our website has an open system for contributors (WP User Role) to add news and calendar content to the site.

I'd like to set and lock the position of the content and meta boxes on the post edit screen. Is there a filter or function to set the order of the boxes before I disable the option of changing the sort order?

For Example, I'd like my post edit screen to appear in one column - Title > Taxonomy > Body > Meta Box > Meta Box > Publish.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Found this while trolling the internets... Works Perfectly

add_action('admin_init', 'set_user_metaboxes'); //I want it to fire every time edit post screen comes up
//add_action('user_register', 'set_user_metaboxes');  //You can also have it only set when a new user is created

function set_user_metaboxes($user_id=NULL) {

  //These are the metakeys we will need to update  
  $meta_key['order'] = 'meta-box-order_events';
  $meta_key['hidden'] = 'metaboxhidden_events';

  //So this can be used without hooking into user_register
  if ( ! $user_id)
    $user_id = get_current_user_id(); 

  //Set the default order if it has not been set yet by the user. These are WP handles
  if ( ! get_user_meta( $user_id, $meta_key['order'], true) ) {
    $meta_value = array(
        'side' => '',
        'normal' => 'events_metabox,submitdiv, commentsdiv',
        'advanced' => '',
    update_user_meta( $user_id, $meta_key['order'], $meta_value );

  // Set the default hidden boxes if it has not been set yet by the user
  if ( ! get_user_meta( $user_id, $meta_key['hidden'], true) ) {
    $meta_value = array('postcustom','trackbacksdiv','commentstatusdiv','commentsdiv','slugdiv','authordiv','revisionsdiv','postexcerpt','postimagediv','tagsdiv-post_tag');
    update_user_meta( $user_id, $meta_key['hidden'], $meta_value );

share|improve this answer
Short version of this Answer. –  brasofilo Jan 6 '13 at 16:29
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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