How to Fix ‘Critical Error’ on a WordPress Website

By | December 16, 2023

Experiencing a critical error on your WordPress blog or website is something capable of causing some setbacks in your publishing career and business as a whole. Apart from the setbacks that come with this type of error, it can usually take a lot of guessing, debugging and trials to get it fixed.

In old releases of WordPress, users used to see a white screen of death whenever an error was triggered but from version 5.2, users now see a detail section on the white screen of death informing them of a critical error on their website.

critical error message
critical error message

If you are experiencing this kind of error for the first time, there is no need to fret because it is a common WordPress error that can be resolved easily. Before we get it resolved, let’s look at why the error was triggered in the first place.

WHAT TRIGGERED THE CRITICAL ERROR ON YOUR WORDPRESS SITE?

Knowing what triggered the critical error can help you retrace your steps to undo the problem and get your blog back on track. While there could have been a lot of reasons that could have triggered the critical error on your website, the prominent reasons include incompatible themes and plugins, unavailable resources on your server or even database corruption.

Also, copying from other websites and pasting them on yours can be a cause of this error. This is because you might have pasted a code, snippet or script that is not properly encoded and compatible with your website.

HOW TO FIX THE CRITICAL ERROR ISSUE ON YOUR WORDPRESS WEBSITE

To get your website up and running once more, we will be providing you with tips on how you can get it resolved as soon as possible.

1. CHECK YOUR WORDPRESS ADMIN EMAIL ADDRESS

Your WordPress-powered website is configured to send an email to the email address of the website administrator whenever a critical error occurs. This message informs you of why the critical error occurred and also contains a recovery safe mode login link that allows you to rectify the issue if the usual wp-admin dashboard is affected as well.

As seen in the screenshot above, I was informed that there was a critical error with my WordPress blog and that it was triggered by the JetPack plugin I recently installed. I need to uninstall the plugin through the recovery link provided in my email address since my wp-admin dashboard was affected by the error to restore the affected website.

If you cannot find the email, check your spam folder and if it is not there, your CPanel’s PHPmailer might be experiencing some issues. You may want to move to the next step, hopefully, it might work out for you.

2. CHECK THE ERROR LOGS IN THE ROOT DIRECTORY

The error_log file logs the errors encountered on your WordPress website on the server side. This way, you can still check for the log of errors caught by the server and you might just find a way to get your site up again.

Go to your file manager in your hosting CPanel or connect via an FTP tool. Locate the root directory of the WordPress installation and look for the error_log file. Right-click on the file for more options and select view.

The file shows you all the errors logged on your WordPress blog since its installation up till the moment you checked it. The most recent errors can be found below with their dates being more recent.

The last visible error in the screenshot above informs us that there is a database error because the database storage is full. What should be done at this point is either to optimize the storage or increase my storage limits by upgrading my hosting plan.

The error_log file is very popular with CPanel WordPress installations. If you are using a different hosting dashboard such as Direct Admin, you may not find the error_log file in your website root installation.

3. ENABLE DEBUGGING ON THE AFFECTED BLOG

Debugging helps you find out what the problem on your blog is. By default, debugging is turned off on WordPress but when running a diagnosis on your blog, you might want to turn it on.

What happens during debugging is that errors and their triggers are often displayed above the header of your blog. This can come in handy if you cannot receive an email on the administrator’s email address or you cannot find an error_log file in your website installation root directory.

To turn on debugging, go to the root directory of the website installation and locate the wp-config.php file. Right-click on the file and select the edit option. Enter the code snippet below:

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

You can save the file and refresh your website. You will be able to see the errors and their triggers above the header section. Rectify the issue, remove the code afterwards and resave the file to turn off debugging.

4. CHECK YOUR HOSTING RESOURCE LIMITS

Your hosting offers you a resource limit when you sign up. These resource limits include bandwidth, storage, memory and RAM size and inodes. When any of these limits are exhausted, your website takes time to load and whenever it loads faster, it pops up a critical error on your screen.

Upgrading your website resource limit when it is full, or optimizing it can fix the critical error issue on WordPress as well.

5. REVERT TO A DEFAULT WORDPRESS THEME

The critical error may be caused by the active theme on your website which conflicts with a plugin or addon. To resolve this and find out if the active theme is responsible, activate one of the default WordPress themes.

Examples of default WordPress themes include Twenty Twenty-Two, Twenty Twenty-Three and Twenty Twenty-Four. If changing to any of these themes does not resolve the critical error issue, then the theme is not to be blamed.

If you are unable to access your wp-admin dashboard, you may do well to upload it through an FTP software or the file manager of your CPanel. From the root directory, locate the wp-content/themes directory and delete other themes you find there.

Head to the WordPress themes directory and download a default theme you can now upload.

6. INCREASE THE PHP MEMORY LIMIT

Running your WordPress blog on a low memory limit brings about the underperformance of the blog. It brings about imposing a limited amount of RAM for running a script or process on your blog as well.

Hence, when you try running larger scripts or processes, it can result in a critical error on your blog. Adding a line of code to your wp-config.php file would do just the magic of undoing the critical error if it was caused by memory under-performance.

Locate the wp-config.php file in the root directory of the blog and add the code below to the file.

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

Other ways to increase the memory limit of your website can be found here. Save the file and if the issue was caused by memory under-performance, it would be resolved instantly.

6. DEACTIVATE THE PLUGINS

If the steps above are not fruitful in resolving the issue on your end, the critical error might be caused by a plugin conflict. Try deleting the last plugin you installed before the critical error notification.

If that does not solve it, go to your file manager and head to the wp-contents sub-directory from the website root. Rename the plugins directory to something else (maybe plugins.old) and save that. Check if your website works fine now.

If it works fine, rename the plugins.old directory back to plugins and save it. Head to your wp-dashboard and activate the plugins one after the other to find the conflicting ones.

Conclusion

The methods listed above are up-to-date and effective in fixing critical error issues on your WordPress website. If after applying these methods, the issue persists, you may want to check the site health of your blog by visiting Tools > Site Health in your admin dashboard to see if there are other things you need to resolve.

Otherwise, you are free to engage me via the comment section if the issue persists on your blog and I will work a way out for you. Thank you for stopping by and do have a great day!

Leave a Reply

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