SEOSEO News

There Has Been a Critical Error on This Website: 6 Quick Fixes » Rank Math


WordPress is one of the most popular website-building platforms in the world. Millions of people use it to create everything from simple websites to complex enterprise solutions.

Despite its popularity, WordPress is not without its flaws!

One of the most common problems you might face is an alarming message like, “There has been a critical error on this website. Please check your site admin email inbox for instructions.” 

This post will show you how to fix this critical error in WordPress quickly. We’ll also discuss what causes this error and how to avoid it. So without any further ado, let’s get started.

1 What is a Critical Error in WordPress?

WordPress’s critical error is an error that prevents it from loading all the scripts it requires to function properly.

there has been a critical error on this website message

Previously, this WordPress problem would display a fatal error message or a white screen of death. Most novices struggled to tackle the problem independently.

To help its users, WordPress has a feature that detects when a plugin or a theme causes a critical error and sends a notification to the admin email address. Check your spam folder if you don’t see any email notifications in your inbox.

In the email, users receive more details about what is causing the issue. The email contains the error caused by a plugin or theme not working correctly. It may also be caused due to database corruption or insufficient memory. Further details, like which line has an error, are explained in the email.

Also, the email consists of a recovery link to access your site in recovery mode. You can log into your WordPress dashboard using the recovery link to resolve the issue.

recovery email

2 What Causes the “There has been a critical error on this website” Error?

The error is generally caused by a malfunctioning plugin, script, or code that prevents WordPress from functioning properly.

If you don’t fix this problem, WordPress won’t be able to load the other files it requires.

Another cause of this error is if you have recently copied and pasted code snippets from some tutorial to your site; it might trigger a critical error when the code is incorrect or invalid for your site. A conflict with another WordPress plugin or custom code may also trigger the error. 

That said, let’s look at how to fix the critical error in WordPress and get your website running again.

3 How to Fix the “There has been a critical error on this website” Error?

We’ll now show you six quick fixes to help you solve the “There has been a critical error on this website” error.

3.1 Check Error Logs

First, you can check the error log file that stores PHP error details.

To do so, use FTP, and navigate to the public_html folder. Look for the error_log file as shown below.

Open the error_log file

The latest error entry will be at the bottom, indicating the **** and time. You can check this error log file to identify the cause of your site’s error. 

error log file

3.2 Enable Debug in WordPress

WordPress has an integrated debugging system that locates coding flaws in the core software, themes, and plugins.

When debug mode is enabled, you can notice the various PHP problems appearing on your site and identify their root cause. To activate the WordPress debug mode, open the wp-config.php file in your public_html directory.

Click on View/Edit wp-config.php file, as shown below.

View/Edit the file

Then add the following code lines at the document’s bottom, just before the message /*That’s all, stop editing! Happy publishing.*/ Once done, click on the Save button. Don’t forget to upload the file back to the server.

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );

Here’s what it will look like:

Enable debug mode

Debugging is now enabled on your site, and errors will be written to the log. You can locate the debug log in the wp-content folder named debug.log.

3.3 Switch to a Default Theme

The next step in troubleshooting the critical error is switching your WordPress theme to a default one. This will fix the critical error issue in your current WordPress theme if some code is the root cause of the error.

Navigate to the WordPress.org themes directory and download a fresh copy of the TwentyTwenty, or Twenty Twenty-One WordPress theme.

download theme

Once the theme is downloaded, unzip the theme file on your computer. Next, connect to your WordPress site using an FTP client or the File Manager in your hosting account.

Once connected, navigate to the /wp-content/themes folder, and you will notice a list of all the themes installed on your website. Download all the theme folders on your computer for backup, as shown below.

download themes

Once downloaded, delete all the folders from your website by clicking the Delete option, as shown below.

delete the theme folders

Now your WordPress site doesn’t have any theme installed. To fix this, upload the default theme folder you downloaded earlier.

upload theme

Once the theme is uploaded to your site, you can try visiting your website. 

If your WordPress theme caused the “There has been a critical error on this website” error, it will disappear now, and you’ll be able to access your website.

3.4 Deactivate All the Plugins

A plugin is often to blame when you experience a critical error. Trying to locate the culprit may seem daunting if you have several or even dozens of plugins on your site.

But there’s an easy way to find the problematic plugin: disable them all and see if that fixes the error. If it does, enable them one by one until your site runs again. And you’ve found the culprit!

Connect your website using FTP or the File Manager app in your WordPress hosting account.

Once connected, navigate to the /wp-content/ folder. Locate the plugins folder, right-click on it, and select the Rename option, as shown below.

rename the plugins folder

Next, change the plugin’s folder name to anything you like. In our example, we’ll rename it as ‘plugins.old’.

rename the plugins folder

Once done, all of your plugins will be deactivated. 

WordPress looks for the plugins folder to load the activated plugins on your website. When it cannot locate the plugins folder, it simply cannot activate them and automatically sets them as deactivated.

You can now visit your website to check if the critical error message has disappeared.

Note: Whether you’ve resolved the critical error or not, don’t forget to rename the ‘plugins.old’ folder back to ‘plugins.’ WordPress will then recognize the folder, and you can reactivate them one by one from the WordPress dashboard to identify which one caused the critical error.

3.5 Raise the PHP Memory Limit

Even if a plugin or theme is to blame for your website’s malfunction, the PHP memory limit is frequently the real offender of the “There has been a critical error on this website” error.

What is PHP’s memory limitation?

WordPress imposes a strict limit on the amount of RAM (also known as memory) that a single PHP script may occupy on your web server. The critical error or the white screen of death will appear when this limit is reached.

To increase the PHP limit, access your site through FTP and open the wp-config.php file. Add the below code snippet before the final line.

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

Once you’ve added the code, click on the Save button.

increase PHP limit

3.6 Check for Malware

Malware can occasionally be the root of the “There has been a critical error on this website” error, especially if you notice odd PHP scripts that you can’t attribute to your plugins or theme. It’s difficult to remove malware when you’re locked out of your website and unable to perform a scan.

It can be challenging to distinguish between trustworthy and suspicious files that malware has added, and deleting random core files isn’t going to turn out well. Malware can also alter PHP files, hiding scripts in them; unless you’re a developer, you won’t be able to detect it.

If malware is the root cause of the critical error, it may be best to turn to your web host for help.

4 Conclusion

There’s no need to panic if you encounter the “There has been a critical error on this website. Please check your site admin email inbox for instructions. message.

Fortunately, there are ways to diagnose even the vaguest error message. Simply check your email address and find an email from WordPress to locate the issue and quickly fix it.

By running through a checklist of common fixes, you should be able to solve the critical error and get your site working properly again.

We also recommend creating backups regularly. With a backup in hand, you’ll be able to restore your site quickly if you get a WordPress error message like this.

Have you ever come across the critical error on your site? How did you tackle it? Let us know by Tweeting @rankmathseo.?





Source link

Related Articles

Back to top button
Social media & sharing icons powered by UltimatelySocial
error

Enjoy Our Website? Please share :) Thank you!