It works just the same like a regular textarea with the exception of the data being escaped so when you call for the saved data just make sure to decode the html entities using html_entity_decode
here is a very simple demo class, take a look at how the field is created.
if (!class_exists('wp_editor_meta_box')){
class wp_editor_meta_box{
public function __construct(){
/* Define the custom box */
add_action( 'add_meta_boxes', array($this,'wp_editor__add_custom_box' ));
/* Do something with the data entered */
add_action( 'save_post', array($this,'wp_editor__save_postdata' ));
}
/* Adds a box to the main column on the Post and Page edit screens */
function wp_editor__add_custom_box() {
add_meta_box(
'wp_editor_box',
__( 'WP Editor Box' ),
array($this,'wp_editor_meta_box'),
'post'
);
}
/* Prints the box content */
function wp_editor_meta_box( $post ) {
// Use nonce for verification
wp_nonce_field( plugin_basename( __FILE__ ), 'wp_editor_nonce' );
$field_value = get_post_meta( $post->ID, '_wp_editor_', false );
wp_editor( html_entity_decode($field_value), '_wp_editor_' );
}
/* When the post is saved, saves our custom data */
function wp_editor__save_postdata( $post_id ) {
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
if ( ( isset ( $_POST['wp_editor_nonce'] ) ) && ( ! wp_verify_nonce( $_POST['wp_editor_nonce'], plugin_basename( __FILE__ ) ) ) )
return;
// Check permissions
if ( ( isset ( $_POST['post_type'] ) ) && ( 'page' == $_POST['post_type'] ) ) {
if ( ! current_user_can( 'edit_page', $post_id ) ) {
return;
}
}
else {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
}
// OK, we're authenticated: we need to find and save the data
if ( isset ( $_POST['_wp_editor_'] ) ) {
update_post_meta( $post_id, '_wp_editor_', $_POST['_wp_editor_'] );
}
}
}//end class
}//end if
new wp_editor_meta_box();