1 column admin screen options – move submitdiv to bottom

Try something like this:

// First make all metaboxes have 'normal' context (note the absence of 'submitdiv')
// If you know the ids of the metaboxes, you could add them here and skip the next function altogether
add_filter('get_user_option_meta-box-order_post', 'one_column_for_all', 10, 1);
function one_column_for_all($option) {
    $result['normal'] = 'postexcerpt,formatdiv,trackbacksdiv,tagsdiv-post_tag,categorydiv,postimagediv,postcustom,commentstatusdiv,slugdiv,authordiv';
    $result['side'] = '';
    $result['advanced'] = '';
    return $result;
}

// Then we add 'submitdiv' on the bottom, by creating this filter with a low priority
// It feels a bit like overkill, because it assumes other plug-ins might be using the same filter, but still...
add_filter('get_user_option_meta-box-order_post','submitdiv_at_bottom', 999, 1);
function submitdiv_at_bottom($result){
    $result['normal'] .= ',submitdiv';
    return $result;
}

And since you’re forcing content into one column, you might want to add these for design consistency:

// Allow only 1 column option on screen options
add_filter('screen_layout_columns', 'one_column_on_screen_options');
function one_column_on_screen_options($columns) {
    $columns['post'] = 1;
    return $columns;
}

// Ignore user preferences stored in DB, and serve only one column layout    
add_filter('get_user_option_screen_layout_post', 'one_column_layout');
function one_column_layout($option) {
    return 1;
}

I’m assuming you’re talking about normal posts, which is what I’ve shown above, but these could be adapted to other post types as well, I guess, using different filters.

Leave a Comment