The “There has been a critical error on your website” is an alarming message for WordPress site owners. It blocks users from visiting the website, and in some cases, you can’t even get into the admin panel. Luckily, it’s possible to fix this issue without taking too much time. This article will discuss the “There has been a critical error on your website” message means and five methods to fix it.
Some WordPress errors may block you from accessing the dashboard, displaying the message, “There has been a critical error on this website. Please check your site admin email inbox for instructions.”
This message means that there’s a fatal PHP error on the site. It occurs when a PHP script stops running and is unable to complete its process. To help its users, WordPress has a feature that detects when a plugin or a theme causes a fatal error and sends a notification to the admin email address. In the email, users receive more details about what is causing the issue.
The email also contains a URL to access the site in recovery mode. Click the link to safely log in to the WordPress dashboard and fix the issue. If you encounter this WordPress error and don’t see any email notification in your inbox, check your spam folder. However, there may be cases when site owners don’t receive the email and have to locate the issue by themselves.
To fix a critical WordPress error, you have first to locate the cause of the problem. The notification email from WordPress provides more details about which file and line of code caused the issue, but don’t worry if you didn’t receive it.
There are five methods to locate and resolve the critical error in your WordPress site.
The first method is by checking the error_log file, which stores PHP error information. Use the File Manager of a File Transfer Protocol (FTP) client on your hosting account and go to home/[username]/public_html/error_log or home/[username]/path-to-wordpress/error_log.
The file records four types of PHP errors – warning, notice, parse, and fatal. At the beginning of each log, you’ll see the type of error that was found. If you find a parse or fatal error, you’ll have to fix it.
If you can’t locate the error_log file, ask us for help. Keep in mind that the error_log file will only be available if you enable PHP error logging. To do so, configure the PHP settings from your cPanel.
If you still can’t check the error log file, try the following method using the debug mode.
WordPress comes with a built-in debugging system that identifies code errors in the core software, themes, and plugins.
To activate the WordPress debug mode, open the wp-config.php file in your public_html directory. Then, find the following lines:
define( 'WP_DEBUG', false ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WP_DEBUG_LOG', false ); define( 'SCRIPT_DEBUG', false );
The “false” values mean that WordPress debug mode is deactivated. Replace “false” with “true” on all lines to activate it. These four lines contain PHP constants. When they’re activated, they perform the following tasks:
If you can’t find those lines in the wp-config.php file, simply add them to the script. Remember to input the “true” value on each line.
After enabling the debug mode, refresh your site. You should see the details above the error message.
Fix the issue according to the instructions, and your site should work normally again. Deactivate the debug mode by changing the values to “false” once you’ve resolved the problem.
The following method will help find conflicts in your theme and plugins. Start by checking your theme. If you have access to the WordPress admin area, simply switch the active theme to a default one such as Twenty Twenty.
However, if you can’t access the admin panel, use the File Manager or an FTP client like FileZilla and go to public_html -> wp-content -> themes. Find your active theme’s folder and rename it into youractivetheme-disabled. Alternatively you can issue following command at on Terminal to switch to a default theme;
# wp theme activate twentytwentytwo
Once you’ve done that, reload the site. If it loads as expected, then there’s a conflicting theme present, and you may have to roll back to the theme’s previous version or get an entirely new theme instead.
On the other hand, if the error persists, you should check if there’s an issue with your plugins. The process is similar to checking your theme. If you have access to the WordPress admin panel, disable all plugins. If you can’t access the admin panel, use the File Manager or an FTP client and go to public_html -> wp-content -> plugins. Rename all plugin directories into plugin-disabled except the Elementor plugin folder if you have it installed.
Refresh your site. If it loads normally, that indicates a conflicting plugin.
To find out exactly which plugin caused the error, you have to reactivate them one by one, reloading the web page every time. If you’ve renamed your plugins’ folders, go to public_html -> wp-content -> plugins. Revert all plugin folders into their original directory names one by one. Alternatively you can issue following command at on Terminal to disable a plugin;
# wp plugin deactivate -all
Even if a plugin or theme is the cause of your broken website, the PHP memory limit is often the real one to blame.
What is the PHP memory limit? Your web server only has a certain amount of RAM, or memory, so WordPress sets a hard limit on how much memory a single PHP script can take up. When this limit is exceeded, you’ll encounter the white screen of death or the critical error.
While you don’t want to set the memory limit too high and allow misconfigured scripts to slow your site to a crawl, the default value may be far too low. Raising your PHP limit just a bit could instantly fix your broken website.
define( 'WP_MEMORY_LIMIT', '128M' );
You can also try 256M if this doesn’t fix the issue, but anything higher is definitely unnecessary unless specifically called for in plugin documentation. If the issue is with the memory limit, the plugin you’re using is almost certainly broken and needs to be disable
If you’re only seeing the critical error in certain situations and not constantly on every page, a small tweak to a few PHP functions might be able to fix it. Uploading large files and finding yourself on an error screen is probably a result of the max upload file size being too small, while certain large pages breaking can be fixed by increasing recursion and backtrack limits.
First, check what your maximum upload size is and compare it to the file you’re trying to upload. You can find this by visiting Media > Add New and checking beneath the file uploader.
To fix either of these issues, you’ll need to log into FTP and edit the wp-config.php file, placing the new code right above the final comment line.
To increase the max upload file size, add this code:
ini_set('upload_max_size' , '256M' );
ini_set('post_max_size','256M');
And to fix the breaking of large pages on your site, add this code:
ini_set('pcre.recursion_limit',20000000);
ini_set('pcre.backtrack_limit',10000000);
Using this method, you need to restore the website files from a backup. An error like this is one reason why backing up your WordPress site is essential.
WordPress requires PHP 7.4 or greater. Check the PHP version on your web host, and if you find you’re using an older version of PHP, upgrading it to 7.4 or greater can fix the “There has been a critical error on your website” error.
There’s no need to panic if you encounter the “There has been a critical error on your website” message. Simply check your email address and find an email from WordPress to locate the issue and quickly fix it.
Even if you don’t receive the email, there are five ways available to resolve the problem:
We also recommend creating backups regularly. Therefore, you’ll be able to restore your site quickly if you get a WordPress error message such as this.
Note: You may also want to check into these other WordPress errors, if you are experiencing multiple of them:
- ERR_CONNECTION_TIMED_OUT — Caused by a slow or overloaded web server.
- ERR_CACHE_MISS — If you see this, look into your website’s cache or PHP tools like plugins, as they’re very likely the cause.
- 500 Internal Server Error — A serious error that can usually be traced back to server file corruption.
- Error Establishing a Database Connection — Corruption in your database or a database server issue can be the root of this problem.
- HTTP 503 Service Unavailable — Indicates an issue with your server.
- HTTP 502 Bad Gateway — Yet another server issue, often caused by too many visitors overloading it.
And if you see any of the above or other strange errors, please raise a support ticket with a screenshot of the error.
If the issue is not found in plugins, themes or PHP configuration, a corrupt WordPress core file or malware could also trigger the critical error in WordPress. The easiest way to fix this is by reinstalling WordPress. You can issue following command at on Terminal to force reinstall WordPress core;
# wp core download --skip-content --force
If nothing works, contact us for a chargeable code fix for your website.