More fixes

WordPress: "The editor has encountered an unexpected error"

You open a post or page and the block editor shows a grey box: "The editor has encountered an unexpected error", with the buttons Attempt Recovery, Copy Post Text and Copy Error. A piece of JavaScript in the editor crashed. The cause is almost always a plugin, the theme, a browser extension or a stale cached script, not your post. Here is how to find which, without losing what you wrote.

What the owner sees

harborbakery.example/wp-admin/post.php?post=412&action=edit

What the checks found


  

First, keep the post safe (one minute)

  1. Click "Copy Post Text" and paste it into a text file. The post is saved in the database and is almost never lost, but this costs nothing.
  2. Click "Copy Error" and paste that too. The first line names the script that crashed, often with a plugin's folder name in it, such as /wp-content/plugins/some-plugin/.
  3. Try "Attempt Recovery". It rebuilds blocks the editor could not read. If the error comes back on every load, the cause is not the post; go on below.

Find the cause, fastest first

  1. Another browser or a private window. If the editor works there, the cause is on your computer: an ad blocker, grammar or password extension, or a stale cache. Clear the browser cache or switch that extension off for your site.
  2. Read the copied error. A plugin's folder name in it is your answer. Update that plugin, or deactivate it and reload the editor.
  3. Clear every cache. A caching or "optimise JavaScript" plugin, the host's cache and Cloudflare can serve an old editor script after a WordPress update. Purge them all, then reload with Ctrl+F5.
  4. Plugins one by one. Deactivate all plugins (or use the Health Check plugin's Troubleshooting mode, which does this only for you, not your visitors), then switch them back on one at a time and reload the editor each time. The one that brings the error back is the cause.
  5. The theme. If all plugins are off and it still fails, switch to a default theme such as Twenty Twenty-Four for a minute. A theme that adds its own editor scripts can crash the editor after a WordPress update.
  6. Only one post fails. A single block in it is broken, often from a plugin you removed. Open the post with the Code editor (the three-dot menu, Code editor), find the block whose plugin is gone, and remove or convert it.

What you see, what it means, what it needs

What you seeWhat it meansUsual fix
Error in one browser onlyA browser extension or cached scriptClear cache, switch the extension off for the site
Copied error names a plugin folderThat plugin's editor script crashedUpdate or deactivate that plugin
Started right after a WordPress updateA plugin, theme or cache is out of stepPurge caches, update plugins and theme
Every post fails, every browserA plugin or the themePlugins one by one, then a default theme
Only one post failsOne broken block in that postCode editor, remove or convert that block

What not to do

Most cases are one cache purge or one plugin. If the editor still crashes, that is what the box below is for. Related: "Updating failed" / "Publishing failed", "The response is not a valid JSON response", changes not showing.