admin管理员组文章数量:1130349
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!
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!
本文标签: metaboxGetting gutenberg (WordPress 5) to save TInymce data
版权声明:本文标题:metabox - Getting gutenberg (WordPress 5) to save TInymce data? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749098265a2315598.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论