In this blog post, we are going to explain a few steps that need to be taken for fixing the most common WordPress error “There has Been a Critical Error on your Website”.
This error is known in the recent versions of WordPress, more precisely from WordPress 5.4 to the latest WordPress 5.7. Before this message, WordPress was only displaying the white screen known as the white screen of death (WSoD). In the next paragraphs, we are going to show you what may be the cause of this and the possible solutions.
Let’s get started, and make your WordPress up and running!
Table of Contents
The Cause of the Error
The message “There Has Been a Critical Error on Your Website” clearly says that some error is causing problems for the website to be accessible in the browser. There may be multiple reasons for this, such as plugins, themes, updates, PHP versions, changes in the document root of the website, memory consumption and etc. We can not know what could be the problem immediately but if we investigate in more detail we can detect the issue and get familiar with it. Once, the issue is detected it is easier to be fixed or reported to the development team or your hosting provider if it is server-related.
Updated PHP Version
When we are updating the PHP version, we do that for better security of the WordPress website and for compatibility of the new plugins or themes installed. But, if we get the error “There has Been a Critical Error on your Website” it is obviously due to the updated PHP version. Just revert the old PHP version via your control panel or remove it and install the old version if you do not have a control panel on your server. Please note, that sometimes an outdated PHP version can break the website. In this case, you need to update the PHP version in order to solve the issue.
New Theme Installed
Sometimes the new Theme can break the website because it may be incompatible with the version of your WordPress or with some plugins. To revert the old theme you can access your WordPress admin dashboard and go to Appereances —> Themes.If this did not help it is best next time before you install a new theme to make a backup of the document root of the website along with the MySQL database dump.
Plugin Issues
Sometimes the plugins can cause this error because it is more likely to install a new plugin than a theme or something else. There are a lot of WordPress plugins available in the plugins section and if you do not read the documentation about the plugin if it is compatible or not with your WordPress version or your theme the installation may be fatal and break your website. After the installation of the plugin, if the website is broken you can simply rename the plugin name to plugin.backup on your server directly, and refresh the page. This way the plugin is disabled and you can access your WordPress admin to remove it. Please note, if there is some broken plugin you will not be able to access the WordPress admin dashboard, and that is why you need to rename the plugin manually on your server or via FTP.
Memory Limit
WordPress has a limit on how much of the memory can be used by any PHP script. If this limit exceeds then there will be the white screen with the error message we are talking about in this post.The PHP memory limit can be increased in the php.ini file or directly in the wp-config.php file located in the document root of the WordPress website. If you have a control panel on your server then, the PHP memory limit can be increased very easily through the panel GUI without modifying the files on the server.
Malware
The malicious codes and scripts can be injected if you are using older PHP versions, or outdated plugins or themes. Removing the malicious codes and scripts is not a very easy task, and sometimes with deleting the malicious scripts can be removed some WordPress core files which can cause different problems. For this, it is best to contact your hosting provider if you have fully managed VPS support included in your services.
Enable Debug Mode
In the previous paragraphs was explained what may be the possible reason causing the error “There has Been a Critical Error on your Website”, but in this paragraph, we are going to tell you how to find easily the right reason for this. You should consider enabling the debug mode in WordPress as an option. With enabled debug mode you will see the exact PHP errors that will appear in the browser. To enable the debug mode open the wp-config.php:
sudo nano wp-config.php
And paste the following lines of code at the end of the file.
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', true ); define( 'WP_DEBUG_LOG', true );
Once, the debug mode and debug log are enabled you can easily debug the issue.
Of course, you don’t have to fix the “There has Been a Critical Error on your Website”. If you use one of our Managed VPS Hosting services, you can simply ask our expert Linux admins to fix this issue for you. They are available 24/7 and will take care of your request as soon as possible.
If you liked this post on how to fix the “There has Been a Critical Error on your Website Error in WordPress”, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.