1

My visual editor is missing in a project

I've tried this guide which includes deactivating ALL plugins, changing the theme, empting the cache and still at that point there was no Visual Editor, only the plain HTML editor.

Turning on define('SCRIPT_DEBUG', true); in the wp-config.php didn't returned any error / warning in the browser console.

The editor's tabs shows empty:

<div class="wp-editor-tabs"></div>

With the browser's element inspector, I manually added the missing HTML tab code:

<a id="content-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);">Text</a>
<a id="content-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);">Visual</a>

Obvioulsly te tabs apeard but clicking on them returned the following JS error:

Uncaught ReferenceError: switchEditors is not defined onlick

I've also reinstalled WP (3.9.1) at: /wp-admin/update-core.php

Still missing the Visual Editor... I'm getting desperate and my client isn't happy. What I didn't do was manually delete wp-admin, wp-include and re-upload from fresh WP installation but it's a live site with heavy traffic and I'm not sure if this is safe.

One error that I've noticed when I turned debug on for a quick check was:

Notice: wp_enqueue_script and wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enquened until the wp_enquene_scripts, admin_enquene_scripts, or login_enquene_scripts hooks.

But how can I know which script caused that?

6
  • Do you have any plugins that effect the TinyMCE Editor, such as TinyMCE Advanced? WordPress 3.9 has a new Editor, so any plugins that aren't updated could be the problem. Jul 10, 2014 at 13:09
  • Right-click on the page and click Inspect Element. Go to the Console tab and you should see where/what the JS error is that is preventing the Editor from loading. Jul 10, 2014 at 13:10
  • Thanks for your answer Eric, but as I said before, I deactivated all plugins and reset the theme... There was still no Visual Editor. Also no JS erros. From what I've noticed, the editor is behaving exactly as if I've activated the "Disable the visual editor when writing" option in the user profile. What could forcing it on anyway? Jul 10, 2014 at 15:03
  • Are you still having this issue? If not, what was the solution?
    – Hector
    Oct 2, 2015 at 19:59
  • @Hector I'm really not sure what the problem was, but I guess something changed the core settings. I backedup the DB and media uploads and made a new installation. Oct 5, 2015 at 8:19

2 Answers 2

3

I had the same problem and the solutions was to check "Disable the visual editor when writing", save, uncheck it, save again, and then it worked.

1
  • I've spent more than I'd like to admit on this bs. Thank you! Jun 16, 2019 at 1:16
1

I had the same error, with no problem in my JS files, after looking a bit around diverse related problems, and tried the same solutions as you (deactivate and reinstall plugins, switch theme etc) Then I found this post : https://support.advancedcustomfields.com/forums/topic/uncaught-referenceerror-switcheditors-is-not-defined/

Ok it's ACF specific but it appeared to me that maybe something went wrong with my current user, after a check in database I found that I had a field missing for the user with that problem. Precisely the one with the rich_editing meta key.

So I fixed my issue using the following method: As always => Backup your database before any kind of modification.

  • Check for the id of the user with that problem.
  • Copy an sql line in php my admin with rich_editing set to true.
  • Set the user_id field to the id you previously noted on first step.

I must have done something wrong at one point and I don't know why that field suddenly went missing. Anyway I hope this could help someone.

Your Answer

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

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