1

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?

0

Sorry to say that I found that was due to a serious internal network problem, the .js/.css files was server damaged and so the editor was not serverd the right way to the browser.

Fixing communication problems also fixed this issue. No changes to the code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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