White text on white background in TinyMCE when wp_editor is called in WP 3.9

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):

  • admin/author-customization-admin.php
  • admin/assets/js/edit-post.js

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.

1 Answer
1

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 );

Leave a Comment