尝试以下操作:
// 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;
}
而且,由于您将内容强制放在一列中,您可能需要添加以下内容以实现设计一致性:
// 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;
}
我假设你说的是正常的帖子,这就是我在上面展示的,但我想,这些帖子也可以适应其他类型的帖子,使用不同的过滤器。