I came into work on Monday with an email stating the visual editor on one of the WordPress sites we manage/maintain wasn’t working.
Sure enough, I was able to replicate the issue and found there were a ton of Javascript errors in the console.
I searched the first error and found several posts on WordPress’s forum that people needed to add the following to their wp-config.php file to fix the issue.
define('CONCATENATE_SCRIPTS', false );
However, nowhere on the entire internet is there an explanation as to why this all of a sudden needs to be added.
Because of that, I started to dig into the problem to see if I could find out what the heck is going on.
I clicked around the WordPress admin area and noticed the issue was always coming back with this line of code.
Uncaught SyntaxError: missing ) after argument list
load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,underscore,thickbox,shortcode,media-upâ¦:227
Line 227 of
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,underscore,thickbox,shortcode,media-upload&ver=4.3.1
is as follows
if(!params['modal']){jQuery(document).bind('keydown.thickbox',function(e){if(e.which==27){tb_remove();return false;}});}}catch(e){}}
This happens when I am on the following pages within the WordPress admin area.
// Dashboard
/wp-admin/index.php
// Plugins page
/wp-admin/plugins.php
// Edit user page
/wp-admin/user-edit.php?user_id=###
// Edit post page
/wp-admin/post.php?post=###&action=edit
On each of those pages, the load-script.php source is different, so I am providing that info below.
// Dashboard
/wp-admin/index.php
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,underscore,thickbox,shortcode,media-upload&ver=4.3.1
// Plugins page
/wp-admin/plugins.php
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,underscore,wp-util,wp-a11y,updates,thickbox,shortcode,media-upload&ver=4.3.1
// Edit user page
/wp-admin/user-edit.php?user_id=###
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,zxcvbn-async,underscore,thickbox,shortcode,media-upload&ver=4.3.1
// Edit post page
/wp-admin/post.php?post=###&action=edit
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,underscore,thickbox,shortcod&load%5B%5D=e,plupload,jquery-ui-position,jquery-ui-datepicker,jquery-ui-menu,jquery-ui-autocomplete,jquery-ui-resizable,jquery-ui-draggable&load%5B%5D=,jquery-ui-button,jquery-ui-dialog,media-upload&ver=4.3.1
I then got to a page in the admin area where the Javascript error DID NOT present itself!
// The page that lists all of the pages on the site
/wp-admin/edit.php?post_type=page
On this page, the load-script.php source is as follows
// The page that lists all of the pages on the site
/wp-admin/edit.php?post_type=page
https://DOMAIN_NAME/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,thickbox,underscore,shortcode,media-upload&ver=4.3.1
I then went to that file directly is a browser and searched specifically for the following string since that is the string that all of the other pages were throwing an error on.
if(!params['modal']){jQuery(document).bind('keydown.thickbox',function(e){if(e.which==27){tb_remove();return false;}});}}catch(e){}}
To my surprise, that line of code IS NOT minified, whereas, the code IS minified in all of the other instances when the Javascript error occurs.
if(!params['modal']){
jQuery(document).bind('keydown.thickbox', function(e){
if ( e.which == 27 ){ // close
tb_remove();
return false;
}
});
}
} catch(e) {
//nothing here
}
}
Nothing on the server was changed/updated nor was WordPress, the theme, or plugins updated.
I also went as far as disabling ALL plugins along with activated the default Twenty Fifteen theme, but the issue still exists.
There are even WordPress sites on THE SAME server as this site that is having problems, and those other sites DO NOT have this problem.
At the end of that day, I don’t really know if the detailed information I provided above helps anyone help me figure out what the heck is going on and why define('CONCATENATE_SCRIPTS', false );
all of a sudden needs to be added to the wp-config.php file to make the Javascript errors go away so the visual editor works again.
If anything, this is the most details I have seen anyone provide in regards to those that have needed to add define('CONCATENATE_SCRIPTS', false );
to their wp-config.php file to get the errors to go away.
You have a syntax error in the JS code:
It is not clear what this code is trying to achieve but there is clear syntax error:
Try changing:
To:
Looks like this code loaded from the file registered as “shortcode”
Also you can try using wp_dequeue_script function to remove conflicting scripts or move them up and down the queue