I'm registering a new post type
register_post_type('datasheet', [
....,
'register_meta_box_cb' => [ $this, "add_metaboxes" ]
]);
Adding metaboxes
function add_metaboxes ( $WP_Post ) {
$id = $WP_Post->id;
$english_description = get_post_meta("$id","datasheet_english_description");
add_meta_box(
$id = 'datasheet_english_description',
$title = 'Scheda tecnica inglese',
$callback = function ( $WP_Post ) {
wp_editor( $english_description, 'data_sheet_english_description', $settings =[
'media_buttons' => false,
"tinymce" => true,
]);
},
$screen = "datasheet",
$context = 'normal',
$priority = 'low',
$callback_args = null
);
}
As you can see I'm trying to use wp_editor
function to add tinymce as editor for my custom field.
As result I can see my custom metadata field. But I can edit only into the 'Text' tab, not into the 'Visual' tab.
Probably I must pass to TinyMCE some more arguments.
Can you help me?