WordPress Critical Error When Editing with Gutenberg – Root Cause + Fix
You click Edit in Gutenberg and the page instantly crashes with: There has been a critical error on this website. This usually means a fatal PHP error or REST API failure triggered by a plugin, theme function, or server setting. Gutenberg is very JavaScript-heavy and interacts with the REST API, so anything that blocks it causes a crash.
Below are the proven fixes in order of impact.
1. Enable Debug to See the Real Error
You can’t fix what you can’t see.
Edit wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Reload the Gutenberg editor.
The actual error will appear in:
/wp-content/debug.log
Typical real-world causes:
- Fatal error in plugin
- PHP type errors (PHP 8.x strict)
- Missing class from a theme
- API conflict
2. Disable Performance/Optimization Plugins
Gutenberg must load dozens of JS modules. Cache or optimization plugins break it.
Temporarily disable:
- LiteSpeed Cache
- WP Rocket
- Hummingbird
- Autoptimize
- Asset CleanUp
- FlyingPress
- Nitropack
If Gutenberg loads normally, the conflict is confirmed.
Then:
- Turn off JS combine/minify
- Disable defer/async for admin
- Exclude
/wp-admin/,/wp-json/,block-editor*
3. Check REST API Health (This is the #1 Root Cause)
Gutenberg works via REST API endpoints.
If REST is blocked, editor crashes.
Check:
Tools → Site Health → Status
Look for:
“The REST API encountered an error”
Reasons include:
- Security plugins blocking
/wp-json/ - Cloudflare firewall rules
- ModSecurity blocking POST requests
- Incorrect .htaccess rules
Fix:
- Allow
/wp-json/* - Whitelist your domain in firewall
- Disable “Block REST API” options
4. Update Outdated Plugins or Block Plugins
A single block extension can break the editor.
Disable plugins one by one:
- Kadence blocks
- Spectra (Ultimate Addons)
- Elementor blocks
- Gutenberg add-ons
- WooCommerce blocks
If the editor opens, that plugin is the culprit.
Update or replace it.
5. Fix PHP Version Issues
PHP 8.2 / 8.3 introduces stricter errors like:
- Cannot use string offset
- Deprecated dynamic properties
- Missing typed return
If your theme/plugin is old, it crashes instantly.
Try:
- Switch to PHP 8.1 temporarily
- Update plugins/themes
Gutenberg core works on PHP 8.x. Third-party code may not.
6. Increase PHP Memory Limit
Low memory stops Gutenberg mid-load.
In wp-config.php:
define('WP_MEMORY_LIMIT', '512M');
define('WP_MAX_MEMORY_LIMIT', '512M');
Restart the editor.
For shared hosting, set this in your panel if wp-config.php is ignored.
7. Clear Browser, CDN, and Server Cache
Old JS chunks = instant crash.
Do:
- Purge CDN (Cloudflare, Bunny, LiteSpeed CDN)
- Clear hosting cache
- Open Gutenberg in incognito
If it works in private mode but not normal mode → browser cache issue.
8. Theme Issues
Bad theme functions can kill the editor.
Test with:
Appearance → Themes → Activate Twenty Twenty-Four
If Gutenberg starts working, your theme has:
- Outdated blocks
- Fatal errors in
functions.php - Breaking enqueue scripts
Check:
- Custom JS/CSS
- Block overrides
- Old child theme code
9. Server-Level Blocking
Some servers kill Gutenberg due to security rules.
Examples:
- Nginx or Apache limits
- ModSecurity
- Firewall POST body filters
If editing crashes only on large posts:
- Increase
client_max_body_size(Nginx) - Increase
LimitRequestBody(Apache)
10. Last Resort: Reinstall Core
Won’t delete your content.
Dashboard → Updates → Reinstall WordPress
This repairs corrupted Gutenberg JS bundles.
Quick Checklist
- Turn on debug → read
debug.log - Check Site Health → REST API status
- Disable optimization plugins
- Update block plugins + theme
- Increase PHP memory to 512M
- Try PHP 8.1 if 8.3 breaks plugins
- Switch to default theme
- Purge CDN + security rules
Once the offending plugin, stale cache, or REST restriction is removed, Gutenberg loads normally again.