2

I use wordpress a lot, i develop for it a lot too!

I have a client website that i have added 10 custom meta boxes to the post edit screen in functions.php . All the meta boxes have an editor using wp_editor()

This all worked find in wordpress 3.8 and 3.9 but now the site has been upgraded to wordpress 4 the editor is refusing to show the visual/text tabs on the editor pane.

I have verified this by deactivating all plugins on my development copy, and the issue persisted. I then installed a second copy of wordpress but 3.9 and the tabs came back!

Any idea why this is happening on wordpress 4?

3
  • 1
    check you javascript console, what error do you get there? Commented Oct 13, 2014 at 16:47
  • there is nothing in the console to indicate any problems.
    – Glen
    Commented Oct 14, 2014 at 9:09
  • Found the problem: "Notice: wp_editor() was called with an argument that is deprecated since version 3.9! TinyMCE editor IDs cannot have brackets. in C:\xampp\htdocs\desc\wp-includes\functions.php on line 3193"
    – Glen
    Commented Oct 14, 2014 at 9:19

3 Answers 3

9

Yes as per @Nibbr Web Development, TinyMCE editor IDs cannot have brackets. Which is the html field ID, so what we will do is create a different but similiar name for the ID attribute and still use our desired name in for the text area field name, like so.

$content = $options['textareafield'];
// editor_id cannot have brackets and must be lowercase
$editor_id = 'textareafield';
// textarea_name in array can have brackets!
$settings = array('media_buttons' => false, 'textarea_name' => 'my_options[textareafield]');
wp_editor($content, $editor_id, $settings);

This should solve this problem. Also for those of you that have problems with the popup windows such as inserting a link.

1

Another reason can be using custom user agent. WP does not recognise it as supported browser, and so these buttons are disabled. So check if $_SERVER['HTTP_USER_AGENT'] value is correct.

Also you can force using rich editor buttons with user_can_richedit filter.

add_filter('user_can_richedit', 'user_can_richedit_custom');
function user_can_richedit_custom($value){
    $value = true;
    return $value;      
}
0

Just in case anyone else is having this problem, I've found that a pretty reliable way to get your visual editor tab back after upgrading to Wordpress 4.0 is:

  • disable all plugins
  • Change the theme to one of the defaults (e.g. TwentyFourteen)
  • Go to "my profile" and check the "disable visual editor" box.
  • Save
  • Go back to "my profile" and uncheck the "disable visual editor" box.
  • Save

Voila, your edit posts and pages screens should now have the editor tabs back. You can now swap themes back to whichever you want to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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