I am new to creating meta boxes and I am trying to create a custom field meta box that is connected to a custom post type which is created by WooTheme Sensei (Post type = lesson). I am trying to use wp_editor, but the issue is I can't seem to get the field to save.

I have checked many similar questions here and Google a lot, trying different solutions but nothing seems to work, I must be missing something!

These are the 3 functions I am using, I tried to turn debugging on but nothing seems to stand out. Any help is appreciated!

add_action( 'add_meta_boxes', 'add_educadme_related_resources_metabox' );
add_action('save_post', 'save_educadme_related_resources', 10, 2);

// Add the Custom Fields Meta Boxe
function add_educadme_related_resources_metabox() {
    add_meta_box('educadme_related_resources', 'Related Resources', 'display_educadme_related_resources', 'lesson', 'normal', 'high');

// The Custom Fields Meta Metabox
function display_educadme_related_resources() {
    global $post;
    // Get the resources data if its already been entered
    $educadme_resources = get_post_meta($post->ID, 'Related_Resources', true);
    wp_editor( $educadme_resources, 'related-editor', array( 'textarea_name' => 'related_resources', 'media_buttons' => false ));

function save_educadme_related_resources(){
    // Is the user allowed to edit the post or page?
    global $post;
    if ( !current_user_can( 'edit_post', $post->ID ))
    // check autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
    // OK, authenticated: we need to find and save the data
    update_post_meta($post->ID, "Related_Resources", $_POST["Related_Resources"]);


1 Answer 1


The second parameter on wp_editor is the "metabox" field id/default name and you need to put this in the "update_post_meta" for wordpress to know what to save or specify the correct textarea_name.

In display_educadme_related_resources() use:

$educadme_resources = get_post_meta($post->ID, 'related-editor', true);

And in save_educadme_related_resources() use:

update_post_meta($post->ID, "related-editor", $_POST["related-editor"]);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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