“The editor has encountered an unexpected error” is an error message that prevents WordPress users from editing their posts and pages using the Gutenberg editor. In most cases, the message results from a plugin incompatibility breaking Gutneberg’s features.
This article will explore what this error message is, why it happens, and what you can do to solve it.
Key takeaways
- This error prevents you from using the Gutenberg editor and results from plugin incompatibilities.
- You can solve the problem by updating WordPress and all plugins, changing to a default theme, switching to the Classic Editor, deactivating all plugins and reactivating them individually, and adding some custom code to WordPress files.
What is the “The Editor Has Encountered an Unexpected Error” Message?
Many WordPress users have tried to post a new blog or edit one of their pages only to receive the message “The editor has encountered an unexpected error” when trying to access the Gutenberg editor.
Some users experience this error in specific pages/posts, while others see it when attempting to edit any page or post. So, what is this error, and why does it happen?
There are several reasons why the “The editor has encountered an unexpected error” error happens, but they’re mostly related to plugin incompatibilities:
- The Gutenberg plugin. Gutenberg is WordPress’s default content editor, allowing you to edit your pages and posts with modular “blocks.” The Gutenberg plugin provides early access to features that are still in development and can be unstable, leading to potential errors such as this one.
- Incompatibility with page builder plugins. Page builders like Elementor, Divi, and Beaver Builder make many developer’s lives easier by allowing them to edit their sites without coding. However, sometimes, these plugins can clash with WordPress’s codebase and lead to errors, especially if you’re using a “beta” or “early access” version of the plugin that is still in active development (more likely to have bugs).
- Incompatibility with the other plugins. Sometimes, it’s hard to tell which plugin is causing the issue, as many plugins modify Gutenberg’s behavior. In these cases, all we can do is deactivate them and start activating them individually until we find the culprit.
Now that we know the most common causes of this error, let’s move on to the potential solutions.
Important: Back Up Your Site Before Trying to Fix “The Editor Has Encountered an Unexpected Error”
It’s essential to create backups whenever you’re about to make any significant change to your site, such as installing or updating themes, plugins, and new WordPress versions, or troubleshooting errors like “The editor has encountered an unexpected error.”
It gives you a checkpoint you can return to if anything goes wrong, allowing you to reverse unintended consequences and try again.
There are several ways to create backups, but using plugins is one of the easiest methods. We’ve used the backup plugin UpdraftPlus, and it’s very reliable.
Read this article for a step-by-step guide on how to back up your WordPress site.
How to Solve the “The Editor Has Encountered an Unexpected Error” Message in WordPress? 6 Solutions
There are several possible solutions to the error. Let’s work through them step-by-step.
#1 Update WordPress and All Plugins
Sometimes, simply updating WordPress and all plugins may fix the error, as the problem may happen only in an older version of either WordPress or any of the plugins you’re using.
To update WordPress and all plugins, follow these steps.
Step 1: Update WordPress
On the admin dashboard, go to Dashboard > Updates.
Scroll down and click the Update to version… button.
The update will take a few seconds, and then you’ll land in the About section of the version you just installed.
Step 2: Update Plugins
Updating plugins is just as easy. From the dashboard, go to Plugins > Installed Plugins.
Click on the empty white box to select all the plugins.
Now click on the Bulk actions menu and select Update.
All plugins will update simultaneously.
#2 Change to a Default Theme
You may be using a theme that is incompatible with your WordPress version or the Gutenberg editor in an unexpected way. In other cases, the theme may be perfectly fine, but one of your plugins may be clashing with it, causing the error.
Regardless of the cause, sometimes switching to a default theme like Twenty Twenty-Four may bring back your editor. To switch themes, go to Appearance > Themes.
Select any of the default themes and click on Activate.
If you stop getting the “The editor has encountered an unexpected error” message after switching to a default theme, one of your other themes or a specific plugin may be causing trouble. If so, consider trying the troubleshooting tips in this next solution.
#3 Troubleshoot Your Plugins
One of the most likely reasons your editor isn’t working is that a plugin is conflicting with some of its features.
If you only started getting this error after installing or updating a specific plugin, the plugin likely introduced a conflict with the editor, the theme you’re using, or another plugin. In this case, you should deactivate the plugin and see if the editor starts working again.
But before moving forward, ensure WordPress is updated.
With WordPress updated, go to Plugins > Installed Plugins and click Deactivate on the last plugin you updated or installed.
Go back to the editor and see if it works now.
What if You Updated or Installed Multiple Plugins Simultaneously?
It’s also possible that your last update was a bulk update involving multiple plugins or that you installed multiple plugins without making backups in between. In that case, you should deactivate all plugins (not just the newest ones) and activate them individually, checking the editor after every activation.
Start by selecting all plugins with the checkmark at the top of the plugins list.
Now go to the Bulk actions menu and select Deactivate.
After that, start activating the plugins one by one. You should activate the most essential plugins first and then proceed in order of importance for your site’s features. At some point, you will activate a plugin that will cause the error to appear again.
When you identify the plugin causing the error, you may need to dive into the plugin settings, Google for a solution, or switch the plugin to one that does the same without causing issues.
#4 Edit wp-config
If you know how to code in PHP, this will be easy. If you don’t, don’t worry, it’s only a matter of copying and pasting a single PHP line into the wp-config.php
file. All you have to do is add the following line at the bottom of the file:
define(‘CONCATENATE_SCRIPTS’, false);
This snippet disables the concatenation of script files. By default, WordPress tries to optimize the admin dashboard by concatenating (combining) JavaScript files into a single file. This can improve load times and reduce the number of HTTP requests made to the server, which is generally good for performance.
But in some cases, this behavior can lead to issues. If there’s a conflict between scripts, or if a particular script doesn’t work well when combined with others, this optimization can cause functionality to break or degrade in the admin panel.
If you’re dealing with conflicting scripts from different plugins, this piece of PHP code may help you overcome the editor error.
However, if you’ve managed to identify the conflicting plugins, you could always reach out to the plugin developers and inform them of the situation. If the conflict is caused by a bug, they may fix it and resolve the issue without having you resort to PHP snippets.
#5 Edit functions.php
This is another alternative that involves code, in this case the functions.php
file for the theme you’re currently using. Look for and remove the following lines from the 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 );
Deleting these lines may speed up your site and resolve the editor error.
#6 Switch to the Classic Editor
Finally, if nothing worked or you don’t want to switch your current plugins, you can always switch to the Classic Editor, the default WordPress editor, before Gutenberg replaced it in version 5.0 (2018).
If you want to go back to the Classic Editor, you can download a plugin. Go to Plugins > Add New Plugin, and search “Classic Editor”.
Install it and activate it. Next time you create a post, you’ll see the classic interface.
Fix the “The Editor Has Encountered an Unexpected Error” Message
While many WordPress users have encountered the “The editor has encountered an unexpected error” message, there are also many ways to resolve the problem.
Most of the time, the problem comes from conflicting plugins, so the solutions involve identifying where that conflict might be, updating everything to ensure it’s not just outdated code clashing, and, in some cases, doing some coding of our own to change some default behaviors that could contribute to the issue.
Hopefully, you now know how to fix the “The editor has encountered an unexpected error” message and get back to editing your WordPress site.
If you found this post useful, read our blog for more WordPress insights and guides!