这可以通过挂钩实现edit_form_after_title
和edit_form_after_editor
然后像元盒子一样继续。我注意到了一个“小问题”,但是,如果您在自定义中交换Visual/Htmlwp_editor
,然后发布/刷新页面,其状态将与主编辑器(帖子内容)相同。
调整立柱类型,page
在本例中。
add_action( \'edit_form_after_editor\', \'no_metabox_wspe_114084\' );
add_action( \'save_post\', \'save_wpse_114084\', 10, 2 );
function no_metabox_wspe_114084()
{
global $post;
if( \'page\' != $post->post_type )
return;
$editor1 = get_post_meta( $post->ID, \'_custom_editor_1\', true);
$editor2 = get_post_meta( $post->ID, \'_custom_editor_2\', true);
wp_nonce_field( plugin_basename( __FILE__ ), \'wspe_114084\' );
echo \'<h2>Aux editor 1</h2>\';
echo wp_editor( $editor1, \'custom_editor_1\', array( \'textarea_name\' => \'custom_editor_1\' ) );
echo \'<h2>Aux editor 2</h2>\';
echo wp_editor( $editor2, \'custom_editor_2\', array( \'textarea_name\' => \'custom_editor_2\' ) );
}
function save_wpse_114084( $post_id, $post_object )
{
if( !isset( $post_object->post_type ) || \'page\' != $post_object->post_type )
return;
if ( defined( \'DOING_AUTOSAVE\' ) && DOING_AUTOSAVE )
return;
if ( !isset( $_POST[\'wspe_114084\'] ) || !wp_verify_nonce( $_POST[\'wspe_114084\'], plugin_basename( __FILE__ ) ) )
return;
if ( isset( $_POST[\'custom_editor_1\'] ) )
update_post_meta( $post_id, \'_custom_editor_1\', $_POST[\'custom_editor_1\'] );
if ( isset( $_POST[\'custom_editor_2\'] ) )
update_post_meta( $post_id, \'_custom_editor_2\', $_POST[\'custom_editor_2\'] );
}