How to Fix WordPress “Critical Error” Message

how to fix wordpress critical error message

WordPress is an open-source CMS built in PHP and MySQL. This CMS is used by many developers, experts, and beginners around the globe. By using WordPress, we do not need any programming skills to develop a website. The downside is, sometimes things go wrong, and you’ll see an error appear. We’re here to show you how to fix the WordPress “Critical Error” message.

WordPress is supported by web developers; they create so many paid and free plugins and themes. That’s why WordPress is considered the easiest way to build a website. The downside is that these developers may sometimes push changes that break your site. In some cases, they may even break everyone’s WordPress installations which would lead to them having to fix it. In other cases, the issue is unique to your site, so you’ll have to do some troubleshooting.

The WordPress “Critical Error” message looks like this:

You might get an error message when accessing your WordPress website and get frustrated. How can you solve this? In this article, we will show you how to troubleshoot and fix the WordPress “critical error” message.

Potential Fix #1: Check Your Email

WordPress will return a “There has been a critical error on this website” message when something is preventing your website from loading properly. When this happens, your WordPress website will also alert you and send you an email. The email will look like this:

As seen in the email, there is a programming issue in our theme’s functions.php file. In this case, you need to check this file for programming errors or replace it with the original functions.php file. It is only an example; you might get a different message in the email. If you do not receive an email about this, most probably your web hosting company blocks outgoing port 25 or it’s blocked by the receiving mail server.

Potential Fix #2: Check Your Website’s Error Log File

When an error message appears on your website, you can always check your website’s error.log file for more information about it. Whatever the error message is, it includes but is not limited to the “There has been a critical error on this website” message. For example, we get this information below from the log:

2024/01/03 18:56:41 [error] 2077503#2077503: *378430 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected 'if' (T_IF) in /opt/websites/yourdomain.com/wp-content/themes/twentytwentyfour/functions.php on line 16" while reading response header from upstream, client: 123.123.123.123, server: yourdomain.com, request: "POST /wp-admin/admin-ajax.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "yourdomain.com", referrer: "https://yourdomain.com/wp-admin/themes.php"

This also tells us that there’s a problem in our functions.php file, as well as what line the problem is on.

The location of the error.log file depends on your web server configuration. If you have cPanel, you can go to cPanel and navigate to Error under the Metrics menu to see the information.

Potential Fix #3: Enable Debugging

Sometimes, the information from the error.log is not enough and there is no indication about the issue we have. In this case, we can enable the WordPress debugging feature. To do this, we need to edit the wp-config.php file:

$ nano wp-config.php

and insert the following into that file.

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

Save the file, then exit.

Now, refresh your web browser. You will see a piece of more detailed information about why your website is down. The same detailed information will also be printed to wp-content/debug.log file. If you want to see the detailed information only in wp-content/debug.log file and not to display it on your website, simply add this line to wp-config.php:

define( 'WP_DEBUG_DISPLAY', false );

With the information from the log, you can google they keyword and learn how to fix it. Mostly, the “Critical Error” Message appears because an error with a plugin, a typo in a PHP file, etc.

4. Switch Theme

Another step you might need to take is to switch your active theme with the default one. You can switch your theme in the dashboard. If the “critical error” message appears in the backend, then you can use WordPress Command Line Interface to activate a new theme through SSH. To get more information about WordPress CLI, you can check our blog post on how to install and use WP CLI on Linux.

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS

First, we need to log in to our server through SSH and navigate to the website’s document root.

$ cd /var/www/html/yourdomain.com

Then activate the default theme using this command below.

$ wp theme activate twentytwentyfour

5. Deactivate Plugins

The critical error message could also be triggered by a plugin. It’s possible that a plugin conflicts with other plugins, or it’s not compatible with your WordPress version. So, the easiest way to check which plugin is causing this is to deactivate all plugins and activate them one by one to troubleshoot the critical error message.

$ wp plugin deactivate --all

Once deactivated, you can activate them one by one through your WordPress dashboard.

That’s it! You have learned how to fix WordPress “Critical Error” message on your own.

Of course, you don’t have to spend your time following this article to fix WordPress “Critical Error” message if you have an active Managed WordPress Hosting service with us, in which case you can simply ask our expert Linux admins to fix WordPress “Critical Error” message for you. They are available 24×7 and will take care of your request immediately.

If you liked this post on how to fix WordPress “Critical Error” message, please share it with your friends, or simply leave a reply below. Thank you.

Leave a Comment