erreur

Troubleshoot with display in WordPress administration

You are on your administration interface and face various bugs: scripts do not seem to run correctly, resources are missing, display bugs occur at different places in the WordPress administration.

  • Examples of these bugs :Your page and article editor does not display your entries correctly.
  • Some menus no longer work
  • Adding media is difficult if not impossible
  • Some features are inoperative

The administration is not loading properly.

The cause

WordPress uses a script concatenation feature, allowing you to load all your back-office javascript files in a single request.

The dependencies will then all be loaded at once.

Unfortunately, sometimes this can cause conflicts between scripts. Sometimes these appear with certain themes or plugins.

Another cause of this error is a cache problem. Some editors are more prone to this problem than others.

A last cause can be a too restrictive .htaccess file. An .htaccess file is used to configure certain server parameters, allowing to define different rules, in particular for access or rewriting. This file is used a lot to improve the security of your site, to configure URL rewriting, to perform redirections or to redirect error messages.

The solution

An “easy” solution to get around this problem is to disable this feature. But by doing this you will lose the benefits. Nevertheless, it may allow you to highlight the problem.

To do so, you just have to add or modify the following line in the wp-config.php file as follows :

define( 'CONCATENATE_SCRIPTS', false );

You can then reload the administration page and see if the result is better.

For a better diagnosis, we also advise you, temporarily, to activate the debug on your WordPress installation.

Still in the same wp-config.php file, located at the root of your WordPress installation, activate the debug with this line in your file, with the value “true” instead of “false”:

define( 'WP_DEBUG', true );

If you are working on a theme or a plugin and you want to provide a small version of your scripts (javascript, CSS…), you can also activate the debugging of the scripts thanks to this line :

define( 'SCRIPT_DEBUG', true );

Finally, use your browser’s console to check for errors or problems, whether the concatenation option is enabled or not. When concatenation is disabled, you can pinpoint the script(s) that are at fault. To activate the console: F12 under Firefox / Chrome, CTRL + SHIFT + C under Opera; then click on the title of the “Console” tab). You will then find errors or attention messages if necessary, targeting certain elements of your site.

Reminder: in production, debug mods must be disabled. So remember to reset the last two parameters to “false“.

We have seen that this kind of problem can also come from a cache. All you have to do is to empty your browser’s cache (see according to your browser the way to do) and try again. Check and empty if necessary also your server cache or some plugins if needed. Also check your plugins and themes whenever. Finally, if you use a CDN (Content Delivery Network) solution, remember to check its configuration.

Finally, we mentioned a too restrictive .htaccess file. It will be necessary to check this file to identify possible rules or restrictions that could interfere with the loading of scripts. Don’t hesitate to call a professional to analyze this file, as it is so important for the security and the good functioning of your website.

Still stuck ? You can contact an expert.

Leave a Comment

Your email address will not be published.

You may also like