Would you like to know how to fix the “There has been a critical error on your website” error? One of the most common errors that WordPress website owners encounter is the message “There has been a critical error on your website,” also known as the “White Screen of Death.”
It may be known in other expressions such as “There has been a critical error on your website” XAMP and “There has been a critical error on your website” in the Elementor website.
WordPress can't provide any information regarding what caused this error message. With no access to the WordPress admin area, troubleshooting becomes much more difficult.
This article aims to explain the cause of the “There Has Been a Critical Error on Your Website” error on your website and how to resolve the error using various methods.
What Causes the “There Has Been a Critical Error on Your Website” Error?
It is likely that if you have been using WordPress for some time, you have heard of or perhaps even encountered the most famous error message that WordPress generates: the White Screen of Death.
When your entire website and sometimes even your back end were affected by this startling bug, the entire page would appear blank and white.
Recently, WordPress has replaced the blank screen with a critical error message and the text “There has been a critical error on your website. Please check your site admin email inbox for instructions.”
This is less alarming than when your site fails to load, but it does not provide much more information and leaves you wondering What has caused this critical error.
This error usually results from an issue with PHP, either that your memory limit has been exceeded or that an error has occurred in your code, plugins, or theme. It may also be a corruption of the database.
Identifying this information makes troubleshooting much easier, although the error text may not be handy.
How to Fix the “There Has Been a Critical Error on Your Website” Error?
Your visit to this page aims to get your site up and to run again. To accomplish this, we have collected several possible methods to fix the error.
The cause of the problem is likely to be PHP-related, so that these steps may involve editing the core files of WordPress.
It is best to back up your website before implementing these methods. We do not want to make the situation worse by implementing some of these suggestions.
If you can access the backend of your website, that will greatly help. However, since your entire site is unavailable, you will likely have to access the site through FTP or SFTP.
Please contact your web host for assistance if you do not find your FTP credentials through your hosting dashboard. An FTP client such as FileZilla should also be installed.
This section will present various methods to fix the “There Has Been a Critical Error on Your Website” error.
Method 1: Enable Debug in WordPress and Check Error Logs
The first thing you should do if you are experiencing problems with WordPress is to enable debugging.
If you use debug mode, you will be able to see the various PHP errors happening on your website, and you can use this to trace the problem back to its source.
If you do not have access to your dashboard, you will also need to turn on the debug log. It will record all PHP errors.
Once you have identified the cause of the error, you may wish to investigate your site by looking around or performing a log review. It is essential to disable debugging once you are finished to prevent visitors from seeing it.
Follow these steps to turn on debugging manually or access the debug log:
- Connect to your site with FTP.
- Locate wp-config.php in the root folder and open it with a text editor or IDE.
- Place the following code just before the final message in the document:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WP_DEBUG_LOG', true );
- Save and close the file once the code has been placed.
Your site has now been enabled for debugging, and errors will be reported to a log file. The debug log can be found inside the debug.log under the wp-content folder.
- Look for the names of your theme or plugins that cause the error or references to a specific file in your theme or plugin.
You must save this information even if you are unsure what to do with it; it can be helpful if you need to contact someone for assistance in the future.
- Make sure to remove these lines of code once you’re finished debugging.
Method 2: Disable All Plugins
There is a high probability that a plugin is the cause of this critical error. There may seem impossible to locate the plugin causing the problem if there are several or even dozens on your website.
However, there is an easy solution to locate the problem plugin: turn them off and see if that resolves the issue.
After this, it is necessary to enable them one by one until they break again and then identify the culprit.
Follow these steps to disable your plugins from the dashboard:
- Go to Plugins in your WordPress dashboard.
- Click on Installed Plugins.
- Check the checkbox at the top of the list to select them all.
- Click Bulk Actions, then Deactivate.
- Click the Apply button.
In most cases, this should be sufficient to resolve any conflicts and restore your website.
Alternatively, you may click Delete to remove all their files. In this case, it will be necessary for you to reinstall them manually or restore a previous backup.
- Turn them on one by one by returning to Installed Plugins and clicking Activate on each to find the plugin that causes the error.
If you would like to do the same thing via FTP, you can do so by following these steps:
- Log in to your site with FTP.
- Go to the wp-content folder to find your plugins.
- Rename the plugins folder to plugins_old and verify that your site is working again.
- Rename the folder back to plugins.
The plugins are expected to be still disabled, allowing you to log in to your dashboard and activate each separately.
You should rename individual plugin folders with _old until your website has been restored if the plugins reactivate automatically.
Method 3: Revert to a Default Theme
There are times when a conflict within your theme causes this critical error. Test for this by deleting the theme temporarily and switching back to the default theme, which should immediately resolve this issue.
Note: before making any changes, create a backup of your site, as you will need a way to recover your theme files once they have been erased. Your custom styling may be lost if you merely reinstall the theme.
Follow these steps to delete your theme:
- Go to Appearance in your WordPress dashboard.
- Click Themes.
- Click on the theme to choose it.
- Click on the Delete option in the lower right corner of the pop-up window.
If you do not see this option, try downloading and switching to another theme. A default theme is the best option.
If you do not have access to your dashboard, follow these steps to revert to the default theme with FTP:
- Connect to your site with FTP.
- Go to wp-content/themes.
In this case, you have two options: either rename the theme folder, enable you to turn it back on later or delete it completely.
- Place the files of the backup or latest default theme into the themes folder.
You should now be able to view your site in the selected theme. If it loads correctly now, you know the issue was associated with the theme.
It is possible to restore your theme files simply by reinstalling the theme or changing the folder's name to the original one.
Method 4: Increase Max Upload File Size and Text Processing Functions
You can slightly adjust to a few PHP functions that may ease your critical error if you only see it in certain situations and not on every page.
Suppose you encounter an error screen when you upload large files. In that case, it probably means that the maximum upload file size is too small. At the same time, recursion and backtrack limits can be increased to resolve the issue.
First, compare the maximum upload size of your account with the size of the file you wish to upload.
Follow these steps to know the maximum upload size of your account :
- Go to Media.
- Click on the Add New option.
- Check beneath the file uploader.
Follow these steps to fix the issue:
- Log into FTP.
- Open the wp-config.php file.
- Place the following code right above the final comment line to increase the max upload file size:
ini_set('upload_max_size' , '256M' ); ini_set('post_max_size','256M');
- Add this code to fix the breaking of large pages on your site:
Method 5: Increase PHP Memory Limit
In many cases, the PHP memory limit is responsible for the issue, regardless of whether a plugin or theme causes it.
The amount of memory or RAM on your web server is limited, so WordPress limits how much memory can be devoted to each PHP script.
If this limit is exceeded, you may encounter the white screen of death or the “There Has Been a Critical Error on Your Website” error message.
Even though you do not want to set the memory limit to an extremely high level to allow misconfigured scripts to slow down your site to crawl, the default value might be much too low.
A slight increase in PHP limits may be sufficient to fix your website's problems immediately. Follow these steps to do this:
- Go to your site through FTP and open wp-config.php.
- Place this code right before the final line and save the file:
define( 'WP_MEMORY_LIMIT', '128M' );
Alternatively, you may try 256M if this does not resolve the issue; however, anything higher is unnecessary unless specifically recommended in the documentation.
Possibly, some hosts impose shallow memory limits and will not let you increase them when you request them. In this case, you can only resolve this problem by switching to a better hosting provider.
Method 6: Clear Your Site Cache
There are several advantages to caching your website; it is usually strictly a good thing.
However, sometimes the cache can become corrupted and cause your website to perform poorly. This may cause the “There Has Been a Critical Error on Your Website” error.
You can resolve this problem by clearing the cache, which should be sufficient to resolve the issue and restore the site to regular operation.
You do not need to be concerned. Your cached version of your pages will soon be restored to full functionality, allowing your website to load faster. Your cache will only need to be cleared once the corrupted files have been removed.
There are various methods to clear your site cache. You can use a plugin, or it is recommended that you review the host documentation; they should be able to provide you with detailed instructions.
Method 7: Upgrade Your PHP Version
In most cases, an outdated version of PHP can cause your website to break, and other conflicts are likely to occur, like the “There Has Been a Critical Error on Your Website” error.
In general, you should ensure that your site runs on the most recent version of PHP. It has been a common practice for WordPress users to stay on PHP 7.4 to avoid conflicts with themes and plugins.
In most cases, this won't cause a problem; however, if you use PHP 5.x, you will have to upgrade because it can cause serious issues.
When performing a PHP upgrade, you should ensure a backup before proceeding.
The steps to upgrade your PHP version depends on your hosting provider. Follow your hosting provider's documentation to upgrade your PHP version.
Method 8: Restore WordPress Backup
You can restore a backup of your WordPress website if you encounter WordPress errors.
Even though this may not always resolve the issue, it is worth trying. If the issue recurs, you can trace the steps you took to cause the problem.
Restoring a website depends on the type of backup you made. If you used a plugin, ensure that you followed its documentation.
You will likely be able to perform backups from your hosting account if backups are included with your hosting plan.
Note: It is recommended that you test the restoration on a staging site before restoring to your live site to ensure that it functions correctly and that you are not overwriting your existing work.
This article aimed to explain the cause of the error “There Has Been a Critical Error on Your Website” in your website and how to resolve the error using various methods.
It is our pleasure that you have taken the time to read this article. In the comment section, you may post any questions or comments.