How to Fix There Has Been A Critical Error On Your Website

How to Fix “There Has Been A Critical Error On Your Website”

You might have just made some changes to your website, updated a plugin or installed an entirely new theme, and then you’re met with a white screen with a text displaying: There has been a critical error on your website.

The easiest way to solve this is to simply roll back your WordPress website to one of your backups. If you don’t have a backup, consider and undo the last change you made. If you installed a plugin, delete the folder.

Now these are some of the brief solutions, I’ve collected 10 different solutions for you to try further down, but before we get into them, I just want to dive into what is causing your WordPress website to display this error.

What Causes Your WordPress Website To Display The Critical Error

Your website is most likely looking like this while you’re reading this article.

there has been a critical error on this website wpenroll

Before jumping into the methods to solve this, it’s essential to understand why it happens, as this will help you solve it much faster.

This error often happens when you install/update a new plugin or theme. Or your server is making changes, such as changing the PHP version.

PHP is the programming language upon which WordPress is built.

If you install a WordPress plugin built for PHP 8 and your server is running PHP 7, then you will see this error. The same goes for WordPress themes.

Another reason can be you’re exceeding your memory limit. Each server has a limit on how much memory you can use. The more processes you do at once, the more memory you use.

[cboxarea id=”cbox-DZ7YzH84qT48YAf1″]

Here is a list of other reasons that could be the reason why your WordPress website is showing an error:

  • HTTP 503 Service Unavailable – This means you have an issue with your server, reach out to your host.
  • HTTP 502 Bad Gateway: This is usually when you simultaneously have too many visitors or bots on your website. Again, reach out to your host for a solution.
  • ERR_CONNECTION_TIMED_OUT: This shows when your server can’t keep up with the visitors on your website. Consider upgrading your server, or ask your hosting for help.
  • ERR_CACHE_MISS: This is a rare error to see, but this shows when there is an issue with your caching files. Simply empty your cache.
  • Error Establishing a Database Connection: This one will most likely show a database error instead of a critical error, but it can occur.
  • 500 Internal Server Error: This is often shown when a PHP error is somewhere, often in a plugin or theme.

How To Fix “There Has Been A Critical Error On Your Website”

Now it’s time to fix the issues. I’ve made the methods to try out in numbered order, and I would recommend you follow this order to try and solve your critical error on your WordPress website.

1. Clear Your WordPress Cache

The first and most straightforward thing to do is to empty your cache. Start by emptying the cache in your WordPress admin area.

If you can’t access your WordPress admin area, then your host might be caching your website, so sign in to your hosting account and empty your cache.

I’ve written a complete guide here on how to empty the cache in WordPress.

You might be using a CDN as well, and you’ll have to try and empty the cache here as well.

I use WP Rocket, a hosting cache, and a CDN cache. So I have to empty my cache 3 places every time to ensure it’s completely cleared.

2. Scan Your Website With Wordfence

Next up is trying to scan your entire website for malware. This step you can only perform if you can access the admin part of your WordPress website. If you can’t, then go to method 3.

Start by downloading Wordfence, it’s entirely free to use, and once it’s installed, then you run a scan.

wordfence scan

Based on this scan, Wordfence will tell you if you have any files with malicious code or outdated plugins.

Often you can fix the issues with a click. Other times you’ll have to follow a guide to fix specific issues.

If you want a more elaborate guide, read my guide on removing malware from your WordPress website.

3. Check Error Logs

Now it starts to become a little technical. Every website has multiple logs, such as access logs that log all visitors accessing your website, but your website also has an error log.

An error log is a file with all warnings and errors noticed by your server. These will be saved in an error log file.

You can often find this with your hosting, where they provide you access, or if you’re using cpanel, you can find it there.

Here you will have to look for errors and ignore notices. When you find an error, then you need to try and read it. It’ll always tell you what file and in the file what line caused the error.

If you can see it’s a plugin or a theme, then deactivate that theme or plugin, and see if it does the trick. If it’s a WordPress error, you might want to try and re-install WordPress.

4. Enable Debug In WordPress

This you can do to be able to see your errors on your website. It’ll display the errors just like you find them in the error log. But it’s easier, for me at least, to do it like this.

Because the errors will also disappear once you fix them one after another, so you get confirmation you’re working in the right direction.

To enable debugging for your WordPress website, you’ll need to access the files through a file manager or an FTP app like FileZilla.

Locate the wp-config.php file, which is in the root of your WordPress installation, and then add the following lines just before $table_prefix = ‘wp_’;

define('WP_DEBUG', true);

define('WP_DEBUG_DISPLAY', false);

define('WP_DEBUG_LOG', true);

Now your WordPress website should start showing errors. Ignore the notices and only focus on the fatal errors.

Look for what files are failing, and if it’s plugin files or theme files, then deactivate those themes or plugins.

If it’s WordPress files, try re-installing WordPress by uploading through File Manager or FileZilla.

5. Solve Theme Or Plugin Conflicts

If you find out the error might be because of a theme or plugin conflict. Or maybe you reached out to help, and they told you to check for this. Then you must start by deactivating all your plugins and installing a standard theme like Twenty-Twenty-Three.

Next, you do one thing at a time. Start by activating your theme again, and see if there is an error on the website. If not, then you continue with the plugins.

As soon as you activate a plugin and the error shows, then you know what plugin is causing the critical error, and then you’ll have to reach out to the plugin developers or find an alternative plugin.

6. Restore The Site From A Backup

Hopefully, you’ve been backing up your WordPress website. Unfortunately, people often don’t start backing up until the accident happens.

If you have backups, the easiest thing to do is roll back to a previous version where you know the error was not showing on your website.

I’ve made a complete guide on how you manage backups for your WordPress website.

If this doesn’t work, then it’s because something has changed on your server, and for this, you might want to try the next step or reach out to your hosting and ask them.

7. Upgrade The PHP Version

A reason can be that your PHP version simply has become outdated. A plugin and a theme are being developed to a specific PHP version.

It’ll often work with multiple PHP versions, but sometimes the theme or plugin developers will use functions only available in the newest version of PHP.

For instance, we saw a significant jump from PHP 7 to PHP 8, where many plugins were causing problems because PHP 8 was discontinuing a lot of functions while introducing new functions.

You can often upgrade your PHP version in your host, where it’s just a simple dropdown. If not, then reach out to your hosting support, and ask them to upgrade your PHP version.

Here is how it looks like if you’re using Kinsta, for instance:

kinsta upgrade php

8. Reinstall WordPress By Uploading The Files

This option often works if you or someone else has changed the core WordPress files.

This is something you should never do, with the exception of wp-config.php.

If you can access your admin area, you can go to updates and click on reinstall. This will completely reinstall WordPress on your server.

reinstall wordpress

If you can’t access your WordPress admin, then you’ll have to do it manually. Go to WordPress.org, and download the newest version or the version you’re currently using of WordPress.

Then via a file manager or FileZilla, sign into your server and delete the 2 folders wp-admin and wp-includes, and then re-upload those 2 folders to your server.

When it’s done, then you have successfully reinstalled WordPress.

9. Increase The PHP Memory Limit

Another way to fix it is to increase the PHP memory limit. As mentioned earlier, your WordPress website might crash if you’re using more memory than your WordPress website allows.

To increase this, you’ll have to connect to your server via a file manager or FileZilla and edit wp-config.php.

If you already have a line with WP_MEMORY_LIMIT, you’ll need to edit that line. Otherwise, you can insert the following line.

define('WP_MEMORY_LIMIT', '256M');

I like to keep my WordPress websites at 256M, but some plugins or themes require more. Just be aware of this. You can often see that in your theme settings

10. Increase The Max Upload File Size and Text Processing Functions

The last solution is to increase the max upload file size or text processing function.

This solution, you should only try if you experience a critical error only to show while uploading an image to your library.

Again you’ll have to connect to your WordPress server through a file manager or an FTP client, locate wp-config.php and edit the file to insert the following 4 lines:

ini_set('upload_max_size', '256M');
ini_set('post_max_size', '256M');
ini_set('pcre.recursion_limit', 20000000);
ini_set('pcre.backtrack_limit', 10000000);

And that’s it, and now you’re through the 10 methods to fix the critical errors on your WordPress website.

What If None Of The Solutions Works?

You might conclude that you tried all 10 methods and simply couldn’t get it to work, or there were some methods you just didn’t know how to solve.

I understand you; some of the solutions are pretty technical. Unfortunately, it’s the only way sometimes to solve it.

But in this case, you’ll need to reach out to a WordPress developer. You can leave a comment, and I’ll try and help you if it’s a simple issue.

Otherwise, look up WordPress developers on Fiverr. It’s simple and a fair price to get WordPress issues fixed.

FAQ

What to do when your WordPress site is down?

You’ll have to debug it. If the entire server is down, reach out to your host. If it’s only your WordPress website, then enable debugging in wp-config.php by adding define( ‘WP_DEBUG’, true ); and then go through the errors on your WordPress website.

Can WordPress take down your website?

If you’re hosting your website on WordPress servers through wordpress.com, then in theory, they could take your website down if you stop paying the invoices.
If you’re self-hosting WordPress, they can’t do anything to your WordPress website.

What can cause a WordPress website to crash?

There are a lot of things that can go wrong and crash your website. A plugin or a theme is 9/10 the case. Other times it’s your PHP version which is a mismatch, or your server is not powerful enough to handle all the traffic on your website.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *