2

One of the features of my plugin is to add a TinyMCE editor instance inside a meta box on the Edit Post screen. This has worked great up until 3.9 and I'm not clear as to what's going wrong.

Here are the relevant files containing the code for the meta box editor (links to files inside Github commit):

What am I missing? This is what I'm given when I load the Edit Post screen:

http://i.imgur.com/6GQUUa9.png

The contents are there though, which you can see when you highlight inside the textarea:

http://i.imgur.com/jTSlgWm.png

On WordPress 3.8.1 the code works just fine:

http://i.imgur.com/i7nTqPb.png

I'm not sure whether it's an issue with the PHP code or the JavaScript. Any help is appreciated.

  • I can confirm that. See ticket #26778. – fuxia Mar 30 '14 at 22:47
  • Can you edit to add the code that is actually initializing your editor? I've been working on TinyMCE all day, and it makes me want to yell and throw things. Do note that tinymce.execCommand( 'mceAddControl', true, id ); changed to tinymce.execCommand( 'mceAddEditor', true, id ); – helgatheviking Mar 30 '14 at 23:41
4

The text goes white when the id attribute ($editor_id) contains []. They are not allowed here.

Make sure the second argument for wp_editor does not contain [], and the text becomes visible again. I have reported that regression with a test case on ticket #26778.

To use brackets in the name attribute, use textarea_name in the settings parameter.

Example

$editor_id   = 'my_editor_1';
$editor_name = 'my_editor[1]';
$settings    = array (
    'tabindex'      => FALSE,
    'editor_height' => 150,
    'resize'        => TRUE,
    'textarea_name' => $editor_name
);

wp_editor( $post->post_content, $editor_id, $settings );
  • That solved it! Thanks for the info (and for reporting it as a bug), I wouldn't have thought of that. – Christiaan Mar 31 '14 at 5:20

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.