WordPress: Fix ‘The editor has encountered an unexpected error’

After upgrading WordPress to the newest version, I received the following error message when trying to edit pages and posts in the WordPress dashboard:

The editor has encountered an unexpected error.
TypeError: Cannot read property 'DotTip' of undefined

I am presented with three options/buttons: Attempt Recovery, Copy Post Text, Copy Error.

Very strange to see such as error, because most of the times, WordPress is quite a stable content management system that is thoroughly tested before it is released to the public. I had to search a bit and do some trial and error, but in the end I found the culprit that solved this error message.

Find below the different steps you can try out in order to also solve this issue on your WordPress installation so that you can again edit your posts and pages without being blocked by this error message.

Option 1: Disable conflicting plugins

Very often, the plugins that you have installed and enabled in WordPress cause issues. Especially plugins that are made by third-party developers (non-Wordpress.org) are sometimes not well tested with newer versions of WordPress.

Disable the plugins one by one, so that you can eliminate the plugins that are not at fault.

Option 2: Edit wp-config to disable script concatenation

In the root of your WordPress installation, find the file ‘wp-config.php‘, open it and add the following line of code at the very bottom:

define(‘CONCATENATE_SCRIPTS’, false);

This small piece of code will disable the concatenation of scripts in WordPress. By default, the different scripts are merged into one file in order to lower the number of HTTP calls. This may be the issue that prevents you from editing posts and pages. This script will only apply to the admin area (and will not affect your actual WordPress website that is served to visitors).

Option 3: Verify script query string

By default, WordPress is adding a little bit of information at the end of every script that contains the version information of WordPress. Example: example.org/script.js?v=5.4 URL will indicate the version of the script.

On my end, I removed the query string via the ‘functions.php‘ file (can be found in the theme directory) in line with optimisation recommendations on site speed and performance.

I removed the following lines of code in the functions file:

function _remove_script_version( $src ){
return add_query_arg( 'ver', false, $src );
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );

Simply refreshing the WordPress edit page then showed me that the issue was fixed.

Final option: Install the Classic Editor

Still no luck? Then maybe installing the Classic Editor solve the issue for you. This is the editor that was previously used inside of WordPress by default, and is now replaced by the Gutenberg editor.

 

Author Bio

Thank you for your interest in my blog! On this miniblog, I write mostly short (technical) blog posts that might interest other people. Read more about me or feel free to contact me.

 

Leave a Reply

Your email address will not be published. Required fields are marked *