$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>metabox - Getting gutenberg (WordPress 5) to save TInymce data?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

metabox - Getting gutenberg (WordPress 5) to save TInymce data?

matteradmin9PV0评论

I'm using this function to add a tinymce meta box:

add_action( 'add_meta_boxes', function(){
    add_meta_box( 'test_tinymce', 'Test TinyMCE', function( $post ){
         $field_value = get_post_meta( $post->ID, 'test_tinymce', true );
         wp_editor( $field_value, 'test_tinymce_id', array(
            'wpautop'       => true,
            'media_buttons' => false,
            'textarea_name' => 'test_tinymce',
            'textarea_rows' => 10,
            'teeny'         => true
        ) );
    }, null, 'advanced', 'high' );
});
add_action( 'save_post', function( $post_id ){
    if ( ! isset( $_POST['test_tinymce'] ) ) {
        return;
    }
    update_post_meta( $post_id, 'test_tinymce', $_POST['test_tinymce'] );
});

The problem is, WordPress doesn't save this at all. I've seen similar posts on the internet with no resolution.

Any way to get the meta value to save?

Thanks!

Post a comment

comment list (0)

  1. No comments so far