, ,

How to Fix the Critical Error in WordPress (Step-by-Step Guide)

How to fix the critical error in WordPress

You open your site and instead of your homepage you get one line of text: “There has been a critical error on this website.” Sometimes it adds “Please check your site admin email inbox for instructions.” The admin dashboard may be gone too.

We have fixed this critical error in WordPress on client sites more times than we can count, and the cause is almost always the same: a PHP fatal error from a plugin, a theme, or a code snippet. Your content is safe. This guide walks through the exact order we use to find the culprit and get the site back, starting with the fastest checks.

What Does “There Has Been a Critical Error on This Website” Mean?

Since WordPress 5.2, WordPress catches PHP fatal errors instead of showing a blank white screen. When code crashes badly enough that the page can’t finish loading, WordPress shows this generic message to visitors and, when it can, emails the site admin a description of the problem plus a special recovery mode link.

So the message itself isn’t the error. It’s a safety net telling you that something in PHP failed. Your job is to find out what.

Common Causes

  • A plugin update or new plugin that conflicts with another plugin, your theme, or your PHP version.
  • A theme update, or edits to functions.php with a missing bracket or semicolon.
  • A custom code snippet pasted into the theme or a snippets plugin.
  • A PHP version change by your host, which breaks older plugins that use removed functions.
  • Exhausted PHP memory on heavier pages like WooCommerce checkout or page builder screens.
  • Corrupted core files after an interrupted update.

Before You Start: Take a Backup

If your host offers one-click backups, take one now, even of the broken site. Some fixes below involve renaming folders and editing wp-config.php, and having a copy means you can undo anything. If the error appeared right after a change and your host has a backup from just before it, restoring that is often the quickest fix of all.

Order to troubleshoot the WordPress critical error: recovery email, debug log, plugins, theme, memory and PHP, core files
Work down this list and stop as soon as the site loads again.

Step 1: Check Your Admin Email and Use Recovery Mode

Look in the inbox of the email address set under Settings → General → Administration Email Address. Check spam as well. The email has a subject like “Your Site is Experiencing a Technical Issue” and usually names the plugin or theme that caused the crash.

  1. Click the recovery mode link in the email. It is time-limited, so use it soon.
  2. Log in with your admin username and password.
  3. WordPress pauses the faulty plugin or theme for your session only and shows a notice at the top of the dashboard explaining what broke.
  4. Go to Plugins (or Appearance → Themes), deactivate the item that is flagged, and check the site in a private browser window.
  5. Click Exit Recovery Mode in the admin bar when you’re done.

If the email never arrived, that’s common on hosts with unreliable PHP mail. Move on to Step 2.

Step 2: Turn On the Debug Log to See the Real Error

The fastest way to stop guessing is to read the actual error. Open your site files through your host’s File Manager or an FTP client, find wp-config.php in the root folder (usually public_html), and look for the line define( 'WP_DEBUG', false );. Replace it with:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Add these lines above the line that says /* That's all, stop editing! */. Setting WP_DEBUG_DISPLAY to false keeps errors out of what visitors see, while WP_DEBUG_LOG writes them to wp-content/debug.log.

wp-config.php settings to enable the WordPress debug log: WP_DEBUG true, WP_DEBUG_LOG true, WP_DEBUG_DISPLAY false
These three lines log errors to wp-content/debug.log without showing them to visitors.

Reload the broken page once, then open wp-content/debug.log. Scroll to the bottom and look for a line starting with PHP Fatal error. It will look something like this:

PHP Fatal error:  Uncaught Error: Call to undefined function example_get_option()
in /home/user/public_html/wp-content/plugins/example-plugin/includes/class-admin.php:42

The file path tells you everything. Here the problem sits inside /plugins/example-plugin/, so that’s the plugin to deal with. If the path points into /themes/, it’s your theme.

When you’re finished, set WP_DEBUG back to false and delete debug.log. Leaving the log on a live site can expose file paths to anyone who guesses the URL. The official debugging guide on WordPress.org recommends using these tools on staging rather than production for exactly this reason.

Step 3: Deactivate Plugins Without the Dashboard

If the log points at a plugin, or you can’t read the log at all, disable plugins from the file system.

  1. In File Manager or FTP, open wp-content/plugins/.
  2. Rename the faulty plugin’s folder, for example example-plugin to example-plugin-off. WordPress can no longer find it, so it is deactivated.
  3. Reload your site. If it works, you’ve found the culprit.

Don’t know which plugin? Rename the whole plugins folder to plugins-off. If the site loads, rename it back to plugins (all plugins will be inactive), then reactivate them one at a time from the dashboard until the error returns. The last one you activated is the problem.

Step 4: Switch to a Default Theme

If disabling plugins didn’t help, test the theme. Go to wp-content/themes/ and rename your active theme’s folder. WordPress falls back to a default theme such as Twenty Twenty-Five, as long as one is installed. If none is there, upload one from WordPress.org first.

If the site comes back, the problem is in the theme or in code added to its functions.php. Restore the theme folder name, then remove your recent edits or roll the theme back to the previous version. This is also why we recommend you add code without editing theme files instead of pasting snippets into the theme directly.

Step 5: Increase the PHP Memory Limit

If the log says Allowed memory size of … bytes exhausted, WordPress simply ran out of memory. Add this to wp-config.php, above the “stop editing” line:

define( 'WP_MEMORY_LIMIT', '256M' );

This only works up to the limit your host allows. If the error stays, ask your host to raise memory_limit for PHP, or check your plan. Our guide to choosing a WordPress hosting provider covers what resources to look for.

Step 6: Check Your PHP Version

Hosts regularly move accounts to newer PHP versions. Older plugins that haven’t been updated may call functions that no longer exist, which shows up in the log as “Call to undefined function” or a deprecated-then-removed feature. You can change your PHP version in cPanel to confirm what you’re running.

Switching to an older PHP version can get the site back temporarily, but treat it as a stopgap. The real fix is updating or replacing the plugin that isn’t compatible.

Step 7: Reinstall WordPress Core Files

If plugins and theme are ruled out and the log points into wp-admin or wp-includes, a core file may be damaged. If you can reach the dashboard, go to Dashboard → Updates and click Re-install version. If not, download the same WordPress version from WordPress.org and upload fresh copies of the wp-admin and wp-includes folders over the old ones. Don’t touch wp-content or wp-config.php; that’s where your site lives.

An interrupted update can also leave the site stuck behind a different message. If you see “Briefly unavailable for scheduled maintenance” instead, follow our fix for WordPress stuck in maintenance mode.

Quick Reference: What the Log Says and What to Do

What you see in debug.logLikely causeFix
Path contains /wp-content/plugins/name/That pluginRename its folder, then update or replace it
Path contains /wp-content/themes/name/Theme or functions.php editSwitch theme, undo recent edits
Allowed memory size exhaustedPHP memory limit too lowRaise WP_MEMORY_LIMIT or ask your host
Call to undefined function after a host changePHP version incompatibilityUpdate the plugin; temporarily switch PHP
Path inside wp-includes or wp-adminDamaged core filesReinstall core files

How to Stop the Critical Error in WordPress From Coming Back

  • Update on staging first. Many hosts include a one-click staging copy. Test big plugin and theme updates there.
  • Update one plugin at a time on important sites, so you know exactly which change broke things.
  • Keep automatic backups with at least a few days of history.
  • Remove plugins you don’t use. Fewer plugins means fewer conflicts and a smaller attack surface. Our WordPress security checklist explains why that matters for security too.
  • Send recovery emails somewhere you’ll see them. You can add define( 'RECOVERY_MODE_EMAIL', 'you@example.com' ); to wp-config.php so recovery links go to a developer or a monitored inbox instead of an old admin address. The wp-config.php documentation lists the other constants you can set.

Frequently Asked Questions

What causes the critical error in WordPress?

It is caused by a PHP fatal error. The most common sources are a faulty or incompatible plugin, a theme update or broken code in functions.php, a custom snippet, a PHP version change on the server, or running out of PHP memory.

I didn’t get the recovery mode email. What should I do?

Check your spam folder and confirm the admin email address is correct. If the email still isn’t there, enable WP_DEBUG_LOG in wp-config.php to read the error, or rename the plugins folder through File Manager or FTP to deactivate all plugins.

Will fixing the critical error delete my posts or pages?

No. Your posts, pages and settings are stored in the database, and the fixes in this guide only deactivate plugins, switch themes or replace core files. Take a backup first anyway, so you can undo any step.

Is it safe to leave WP_DEBUG turned on?

Not on a live site. Once the problem is fixed, set WP_DEBUG back to false and delete wp-content/debug.log, because the log can reveal file paths and other details about your server.

Is the critical error the same as the white screen of death?

They have the same root cause. Before WordPress 5.2, a PHP fatal error usually produced a blank white screen. Newer versions show the critical error message instead and offer recovery mode.

Get Back Online, Then Find the Cause

In most cases the fix takes a few minutes: read the error, rename one folder, reload. The part people skip is what comes after. Once the site is up, update or replace the plugin that crashed, turn debugging off, and set up staging so the next update doesn’t take the site down.

If you’re stuck on a specific error line, paste it in the comments below and we’ll help you read it.


Discover more from WPFresher

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from WPFresher

Subscribe now to keep reading and get access to the full archive.

Continue reading