JQuery error (tinyMCE not defined) in Wordpress admin panel

After upgrading Wordpress from 3.2 to 3.5, I get a jQuery error on the admin side. Below is the error.

Error: ReferenceError: tinyMCE is not defined Source File: http://domainname.com/wp-includes/js/tinymce/langs/wp-langs-en.js?ver=345-20111127 

Can someone please help me here. Thanks

+4
source share
5 answers

From the documentation:

Using your browser to diagnose JavaScript errors

If you are having problems with interactive features, this may be due to JavaScript errors or conflicts. For example, pop-up menus may be damaged, metaboxes cannot be dragged, or the add media buttons do not work. [...] This guide will show you how to diagnose JavaScript problems in different browsers.

  • Step 1: try a different browser
  • Step 2. Enable SCRIPT_DEBUG
  • Step 3: Diagnostics
  • Step 4: Reporting
-3
source

Better use an ad:

 define('CONCATENATE_SCRIPTS', false); 

in wp-config.php .

+22
source

After reading a million messages about disabling everyone, reinstalling everything, waving chicken bones over my keyboard and throwing salt over my shoulder, I decided seriously.

tinyMCE is not defined, that’s exactly what. Assumption: it never loaded. Check the source of the page http://yourdomain.com/wp-includes/js/tinymce/tiny_mce.js?ver=359-20131026 '> or any other script tag for tiny_mce.js. I bet you don’t have it. If you do, this is not the solution for you. If you do not, read on.

I found code that should place the js tag on your page in ... \ wp-includes \ class-wp-editor.php.

There is an if if block "if ($ compress) {..." that will load ... \ wp-includes \ js \ tinymce \ wp-tinymce.php into the js tag (doesn't work) when $ compress = 1 or ... \ wp-includes \ js \ tinymce \ tiny_mce.js when $ compress = 0. Therefore, I set $ compress = 0 in front of the if block to force else. This fixed my problem.

This is an easy fix, and if it does not solve your problem, it can easily be undone without risking breaking anything else in the WP ecosystem.

+17
source

In my situation, disabling the extended functions.php javascript that I did in functions.php led to the disappearance of this error when loading the editing pages.

+1
source

For anyone who comes across this and pulls their hair a little, @ dale3h's answer was the solution for me.

If you have a function in your functions.php which script_loader_tag script_loader_tag and does not always return the corresponding parts of the original markup of the tag, or there is some kind of error in it, this may lead to the fact that some scripts will not be loaded, because Scripts for The output to the page is first run through this filter.

Something I did to avoid this is whitelist script descriptors depending on what additional attributes I want to give them so that the work can be performed conditionally (leaving all other scripts unchanged):

 // Manage extra attibutes for enqueued scripts function foo_script_extras( $tag, $handle, $src ){ $whitelist = array( 'js-font-awesome-core' => array( 'sri' => 'sha384-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'defer' => true ), 'js-font-awesome-light' => array( 'sri' => 'sha384-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'defer' => true ), 'js-popper' => array( 'sri' => 'sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ' ), 'js-bootstrap' => array( 'sri' => 'sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm' ), 'js-gtag' => array( 'async' => true ) ); // Construct the script if we want to give it extra attributes if( array_key_exists( $handle, $whitelist ) ){ // Extra markup $extra = ''; $mods = $whitelist[$handle]; // Check for SRI if( array_key_exists( 'sri', $mods ) ){ $extra .= ' integrity="' . $mods['sri'] . '" crossorigin="anonymous"'; } // Check for deferral if( array_key_exists( 'defer', $mods ) ){ $extra .= ' defer'; } // Check for async if( array_key_exists( 'async', $mods ) ){ $extra .= ' async'; } // Reutrn full script tag return '<script src="' . $src . '"' . $extra . '"></script>'; }else{ // Return the tag as-is otherwise to avoid breaking it return $tag; } } add_filter( 'script_loader_tag', 'foo_script_extras', 10, 3 ); 

This is not a very general solution in terms of checking which attributes to add to the white list descriptors, and I would use something like "for each attribute of the white list descriptor, add the key if it is logical and true, otherwise add this value "but SRI needs two attributes (integrity and cross origin), so I left it now.

In addition, if you do not see /wp-includes/js/tinymce/ somewhere in the layout of your page (similar to what @Mar said, but the exact script name may change in different versions), then this script does not load!

0
source

All Articles