How to Fix the “There Has Been a Critical Error on This Website” in WordPress
Understanding the Critical Error Message
Error Causes: The Error Related Common Causes
- Plugin Conflicts: A badly or incompatibly coded plugin can create havoc with your functionality site.
- Theme Issues: Using outdated or incompatible themes can throw critical errors.
- PHP Version Incompatibility: Well, maybe your server is running an old version of PHP that is incompatible with your WordPress site.
- Memory Limit Exhaustion: This error might result from your website overspending the allocated memory limit.
- A corrupted .htaccess file can cause a host of other problems, and this error is no different.
Step-by-Step Solutions
1. Enable Debugging Mode
- Before you start anything, enable WordPress debugging to get more information about the error.
- Open the file at /wp-config.php in the root directory of your WordPress directory.
- Find the line with define(‘WP_DEBUG’, false); and replace it with:
This will log errors to a file named debug.log in the wp-content directory, and you can refer back to these without having them display to your users.
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
2. Disable All Plugins
By and large, malfunctioning plugins are causing it. Here’s how you can disable all of them:
- Access your site via FTP or your hosting provider’s file manager.
- Rename the folder named plugins to another folder named plugins_old within the directory wp-content.
- Check your website. If you can view your site, that is on you – that is a problem with the plugin.
How to find the problematic plugin: rename the folder back to plugins and reactivate each plugin individually via the WordPress dashboard.
3. Switch to a Default Theme
If enabling/disabling plugins does not solve the problem, then it could be something to do with your theme.
- Switch to the wp-content/themes directory.
- Rename the active theme folder to something like mytheme_old.
- WordPress will fall back to a default theme, probably Twenty Twenty-One or Twenty Twenty-Two.
Try out your site again. If that loads, then your theme is likely the one.
4. Boost PHP Memory Limit
Just in case your site is running out of memory, increase PHP memory limit.
- Edit wp-config.php file.
- Add the following line in place of the one that says: /* That’s all, stop editing! Happy blogging.
define('WP_MEMORY_LIMIT', '256M');
5. PHP Version Test
Your server should be using a compatible PHP version. WordPress has recommended a PHP version of at least 7.4. As such, go through your hosting control panel and test for an update for the PHP version.
6. Reset the .htaccess File
- Rename the current .htaccess file to .htaccess_old.
- Go to your WordPress dashboard, then Settings > Permalinks and click on ‘Save Changes’ to regenerate the .htaccess file.
7. Restore from Backup
For most people this would be the quickest fix, it will depend on how often you have a recent backup of your site. Most providers of hosting will have some backup solution, so check with them if unsure.
Conclusion
By following this guide, you’ll be back on track in no time, ensuring your WordPress site runs smoothly and efficiently.
Additional Tips for Prevention
- Keep your themes and plugins updated.
- Regularly back up your site.
- Keep monitoring the performance and error logs of your website.
In case of a snag, look for your hosting provider or a professional developer who can bail you out. Happy blogging!