WordPress – The Editor Has Encountered an Unexpected Error [Solved]

Gutenberg editor error

A pesky error that WordPress users have become somewhat accustomed to seeing is the ‘Editor Has Encountered an Unexpected Error’ thrown when attempting to use the newer Gutenberg visual editor to create or edit posts and pages. This can be a real pain, as it completely prevents you from editing anything!

Common solutions found online often include disabling plugins to see which ones might conflict, and switching to different themes.

Others suggest you install Classic Editor, a plugin that enables the ability to use the old editor we all know and love. This can be extremely useful, especially if you aren’t exactly the biggest fan of Gutenberg. We know there’s a lot of controversy over the new block editor, and it’s not exactly everyone’s cup of tea.

What if you’d actually like to get Gutenberg working again, though? What if the new editor, and having everything broken into easy-to-use blocks, is exactly how you’d like to write your posts?

If, like me, neither of these solutions work for you and you happen to be on Nginx rather than Apache, you might be able to resolve the ‘editor has encountered an unexpected error WordPress’ with the following config change:

Check your Nginx config (often located in /etc/nginx/sites-available) and look for the following line:

location / {
        try_files $uri $uri/ /index.php?$is_args$args;
}

For me, removing the ‘?’ question mark between /index.php and $is_args was the solution. Check that your line matches this:

try_files $uri $uri/ /index.php$is_args$args;

Then, save the config file, reload nginx:
sudo service nginx reload

Try editing/creating the post or article again, and see if Gutenberg works now.

Did this fix resolve your issue? Let me know in the comment section!

Leave a comment

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