Critical Error
Symptoms
You hit a white screen that says “There has been a critical error on this website.” Maybe you also got an email from WordPress about recovery mode. This is WordPress 5.2+‘s fatal error handler catching a PHP error that would otherwise crash your site completely. The good news: your data is fine. The bad news: something in your code is broken and you need to find it.
What Causes Critical Error?
- Plugin conflict or broken update — A plugin updated and now throws a fatal PHP error. This is the cause about 70% of the time.
- Theme incompatibility — Your theme requires a PHP version or WordPress version you don’t have, or a theme update introduced a bug.
- PHP version mismatch — Your host upgraded PHP and a plugin hasn’t caught up. Old plugins calling deprecated functions will crash hard on PHP 8.x.
- Exhausted memory limit — WordPress ran out of the memory PHP allocated to it, usually during a heavy operation.
- Corrupted core files — Rare, but a failed WordPress core update can leave files in a half-written state.
How to Fix It
Step 1: Check the Recovery Mode Email
WordPress sends a recovery mode email to the admin address on file. Open it and click the recovery mode link — this gives you temporary admin access even while the site is down.
If you never got the email, check your spam folder. If it’s not there, skip to Step 2 — you’ll fix this from the server side.
Step 2: Enable Debug Logging
Connect to your site via FTP/SFTP or your host’s File Manager. Open wp-config.php in the root directory and find the line that says That's all, stop editing!. Add these lines above it:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Setting WP_DEBUG_DISPLAY to false keeps errors out of your HTML output — the right way to do this on a live site. Errors go to wp-content/debug.log instead.
Reload the broken page, then open wp-content/debug.log via FTP. The last few lines will tell you exactly which file triggered the fatal error. You’ll see something like:
PHP Fatal error: Uncaught Error: Call to undefined function some_function()
in /home/yoursite/public_html/wp-content/plugins/broken-plugin/includes/class-main.php on line 42
That file path tells you whether it’s a plugin or theme issue.
Step 3: Deactivate the Problem Plugin
If the debug log points to a plugin, rename its folder via FTP to deactivate it instantly:
Navigate to wp-content/plugins/ and rename the offending plugin folder. For example:
wp-content/plugins/broken-plugin → wp-content/plugins/broken-plugin-disabled
If you have WP-CLI access (and you should — skip this if you want headaches later with manual FTP every time something breaks):
wp plugin deactivate broken-plugin
If you’re not sure which plugin is the problem, deactivate them all:
wp plugin deactivate --all
Then reactivate one at a time until the error returns. That’s your culprit.
Step 4: Switch to a Default Theme
If the debug log points to your theme, switch to a default theme via FTP. Rename your active theme’s folder in wp-content/themes/:
wp-content/themes/your-theme → wp-content/themes/your-theme-disabled
WordPress will fall back to the latest default theme (Twenty Twenty-Five). Or with WP-CLI:
wp theme activate twentytwentyfive
Step 5: Increase the PHP Memory Limit
If the debug log shows Allowed memory size exhausted, bump the limit in wp-config.php:
define( 'WP_MEMORY_LIMIT', '256M' );
You may also need to set it in your .htaccess file:
php_value memory_limit 256M
Or in php.ini if your host allows it:
memory_limit = 256M
256M is plenty for most sites. If you need more than that, you have a plugin with a memory leak — find it and replace it.
Step 6: Reinstall WordPress Core
If none of the above works, core files may be corrupted. WP-CLI makes this painless:
wp core download --skip-content --force
This replaces all core files without touching wp-content/ — your themes, plugins, and uploads stay intact. If you don’t have WP-CLI, download a fresh copy of WordPress from wordpress.org, extract it, and upload everything except the wp-content folder via FTP.
After fixing the issue, go back to wp-config.php and disable debug mode:
define( 'WP_DEBUG', false );
Don’t leave debug logging on in production. It writes to disk on every page load and the log file grows until it eats your storage.
Prevention
- Stage updates before applying them to production. Use a staging environment (most managed hosts like Kinsta and SiteGround offer one-click staging) to test plugin and theme updates before pushing live.
- Keep PHP current and test compatibility. When your host offers a PHP upgrade, test it on staging first. Check the WordPress plugin compatibility checker or the plugin’s changelog for PHP version support.
- Use a site health monitor. The built-in Tools → Site Health screen flags outdated PHP, plugin conflicts, and memory issues before they become critical errors.
- Maintain WP-CLI access. When your admin dashboard is locked out, WP-CLI is the fastest way to diagnose and fix issues from the command line. Ask your host to enable it if it’s not already available.
Last verified: April 2026
Related reading
- plugin
- theme
- wp-cli
- wordpress-core
- Kinsta Review 2026: Premium WordPress Hosting Worth $35/Month?
- SiteGround Review 2026: Speed, Support, and the 2025 Price Hike Verdict
- Cloudways vs Kinsta (2026): Cloud Hosting Compared
- Hostinger vs SiteGround: Which WordPress Host Actually Delivers in 2026?
- Kinsta vs WP Engine (2026): Premium Managed Hosting Compared
- SiteGround vs Bluehost (2026): Which Budget Host Is Better?
- WordPress.com vs WordPress.org (2026): Which Should You Use?
- dashboard