wp_editor not working for me on custom post type

Question

I have a custom post type that works great, except that I’m now replacing the textarea input with the wp_editor so that it will accept HTML and include all of the styling buttons. Here is my CPT meta box code:

function post_meta_box_desc(){
    global $post;
    $custom = get_post_custom( $post->ID );
    $desc = $custom[ "_post_desc" ][ 0 ];
    $settings  = array( 'textarea_rows' => 10, 'textarea_name' => 'courses-desc' );

    wp_editor( $desc, 'courses-desc', $settings );
}

I used the following code for the textarea instead of wp_editor(), which worked fine, but without all the options:

echo '<textarea name='_post_desc' id="courses-desc" rows="10" style="width: 100%">'.$desc.'</textarea>';

The editor shows up just fine, but my problem is that anything I type in the box doesn’t get saved with the post when I edit. Any suggestions?

0
Mr Gandy 2 years 2020-12-16T15:10:32-05:00 0 Answers 7 views 0

Leave an answer

Browse
Browse