As a WordPress site owner or administrator, any bug or error you encounter is frustrating. This one, in particular, is worrisome since your site will remain inaccessible to visitors and you won’t be able to access the admin panel. You’ll recognize it on account of this message and a link to the WordPress debugging guide.
To fix it, first let’s take a look at why this error occurs so you’ll know how to reduce the likelihood of it happening again.
Common Causes of the WordPress Critical Error
There are a number of likely culprits that cause this kind of fatal error in WordPress. For example:
- PHP memory limit exceeded
- Outdated PHP version
- Coding syntax error
- Plugin or theme conflict
- Broken plugin or theme
- WordPress core corruption
Even if you don’t have a clear idea of what caused the error or downtime, the troubleshooting process won’t take long to work through.
How to Fix the “There Has Been a Critical Error on Your Website” Error
Below are seven methods for resolving critical errors on your WordPress site. Start at the top and work your way through the fixes one by one to pinpoint and fix the issue.
1. Review the Email Sent to the Admin
In the case of a plugin or theme breakdown, the “There has been a critical error in your website” error will send an email to the administrator’s inbox. So that’s the first thing to try.
Although the WordPress critical error text is too vague to provide an idea of what went wrong with your site, the email should help. It serves a number of purposes:
- Notify you when the fatal PHP error occurs and your site goes down.
- Tell you which of your themes or plugins the error was found in.
- Provide you with error details, pointing you to a line of code where the error occurred.
If you are not the admin of the website, track down the person who is. They will need to complete this process via their login.
Here’s what happens next:
Click the link provided in the email. It will take you to the WordPress dashboard with recovery mode now activated.
At the top of the dashboard you’ll see a couple of notices. One will tell you that recovery mode is active. The other will show you where to go to fix the error with your theme or plugins.
Follow the steps. You will either need to deactivate the plugin or theme.
You should also notify the theme or plugin author so they’re aware of the error. If it’s something that’s affected numerous sites, they can issue a patch, save others from the fatal error, and give you a new working version of the theme or plugin to use.
Turn off recovery mode once the issue has been resolved.
If you don’t receive an email or can’t find it (which can happen if the admin is long gone), work through these remaining steps to troubleshoot the issue.
2. Enable Debug Mode for WordPress
The automated email from WordPress isn’t the only one that can tell you where the issue lies. For instance, in debug mode, WordPress is able to automatically detect PHP errors in the WordPress software, themes, and plugins.
Go to your hosting account and open up your FTP or File Manager. (Within SiteGround, for instance, you’ll find this under Site Tools > Site.)
To enable debug mode in your WordPress site, open the wp-config.php file with a text editor or IDE. You’ll find this file at the root of your website which is called public_html.
Include the following code at the bottom of the file:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
Save the file and restart your website. Errors will be added to a file called debug.log, which you can find in the wp-content folder. Inspect the logs. They should point to the theme or plugin responsible as well as the line(s) of code where the error took place.
Choose the step below based on what the debug message tells you:
- If it references a theme, go to Step 3.
- If it references a plugin, go to Step 4.
- If it references a WordPress folder or file, go to Step 5.
- If it references “memory exhausted”, go to Step 6.
If you still can’t tell what the issue is, go through the following steps one by one. Before you do, remove these lines of code from the wp-config.php when you’re done with debugging.
3. Return to a Default Theme
One of the reasons your website might experience a critical error is if there are conflicts in the PHP code powering your site’s theme.
To check if a theme is responsible for your WordPress error, switch the current theme to a default one such as Twenty Twenty-Four. If you can access the admin panel, go to Appearance > Themes, search for a default theme, and install and activate it.
If you still don’t have access to WordPress, go into your File Manager or FTP. Open the wp-content folder.
Rename the themes folder to something like old-themes or disabled-themes. This will automatically disable your current theme and activate the latest WordPress default theme.
Try accessing your site to see if this resolved the error.
If it did, then you need to find yourself a new theme or roll it back to the last version. Then notify the developer about the issue.
4. Deactivate Your Site Plugins
If the WordPress critical error occurred just after you installed or updated a plugin and the theme isn’t to blame, then you may have found the source of the error.
If you know which plugin changed, try deactivating that one. If you don’t, you’ll have to go through a process of elimination to find the problem plugin.
If you can get into WordPress, you can deactivate plugins from the Plugins area in your WordPress admin panel.
In the event that you’re blocked from accessing the backend, you’ll have to deactivate the plugins manually.
You can find all the plugins used in your site by navigating to wp-content > plugins from your WordPress site’s root directory.
Similar to deactivating the theme, all you need to do is rename the plugin (if you know which one caused the error) or the entire plugins folder. This ensures that WordPress loads without the problematic plugin when you next restart your WordPress site.
Try accessing your site again. If it works, then one or more plugins are to blame.
If you know which plugin it is, open WordPress and find a replacement for it, if you need one.
If you’re not sure, reinstall each plugin, making sure only one plugin is active at a time. When the site goes down again, you’ll have found the issue.
It might not be a singular plugin that’s the issue. You may need to try installing plugin pairs to see if a conflict causes the issue. If it does, then uninstall the incompatible pair and reach out to their developers to see if they can issue a patch. If not, find different plugins.
5. Replace Corrupt WordPress Files
If the debug file told you that the corruption lives in your WordPress files (and not a theme or plugin), you’ll need to replace those files.
Go to WordPress.org and click Get WordPress. Download the latest version of WordPress.
Unzip the file on your computer. Search for the folder or file indicated in the debug message. Then return to your File Manager or FTP.
Next, replace the corrupted files with the fresh ones from WordPress.
Return to your website to see if it’s back online. If it is, then you’re good to go.
6. Increase the PHP Memory Limit
If you’ve ruled out plugins, themes, and WordPress itself, then you need to look at your server next. In this case, the default memory limit isn’t sufficient for what you’re trying to do (like uploading a huge video file or theme package).
There’s a limit on how much memory PHP scripts can use. If you’ve executed an action that exceeds that limit, the WordPress critical error message will appear.
You can adjust this limit though.
Go into your wp-config.php file. Look for a string that looks like this:
‘WP_MEMORY_LIMIT’, ‘32M’ );
If there isn’t one, you can add your own to the bottom of the file. Change the
32M value to
64M. Save your changes.
If that doesn’t return your site to you, try the max limit of
256M. (Just make sure it’s within the memory limits allotted by your web host.) Save your changes once more.
7. Upgrade the PHP Version
Using an old version of PHP may also cause a critical error in WordPress. For this reason, you should always use the latest stable version of PHP.
Stable versions are not prone to errors like the older versions. You also don’t have to worry much about plugin and theme incompatibilities.
If you’re not sure what version of PHP you’re on, go into your hosting account and look for a PHP Manager section. In SiteGround, for instance, you’ll find this under Dev.
If your server isn’t set to automatically update to the latest version of PHP, change these settings so that it does. Save your changes and then return to your site. Everything should be restored at this point.
It can be nerve-wracking to discover that you’ve been locked out of your WordPress dashboard and that visitors can’t get into your site. Every second your site is down will cost you business.
Thankfully, there’s a good chance you’ll receive help from WordPress in the form of an email with this WordPress critical error. It will help you pinpoint the source of the error and activate recovery mode.
And if you or your admin never received the email, that’s okay. This issue can be resolved by walking through the troubleshooting steps above.
If all else fails, contact your web hosting support. Even if they can’t identify the source of this fatal error, they can help you roll your site back to safety and get everything back online.