How to fix the WordPress Critical error

The following error message is usually caused by a malfunctioning plugin, theme, or code in one of the WordPress files - "There has been a critical error on this website. Please check your site admin email inbox for instructions":


In this guide, we will describe the most common ways to resolve the issue and recover your website content.

NOTE: Please make a full backup of your website before applying any changes. If the website is added to the Softaculous script installer, please follow this guide.


Clear cache


Errors may be caused by the cache, either in your browser or the server side. To see if the issue is caused by the cache, try the following:



Switch PHP versions


Since some plugins, themes, or WordPress versions are incompatible with certain PHP versions, you should try changing your PHP version first. See these guides on how to use PHP versions with your hosting plans:



Check the error_log file


Critical errors may commonly be caused by an issue with a plugin, theme, or one of the default WordPress files. Check the error_log file in the root folder of your website to see which file caused the error.

If you don’t know the name of the root folder for your domain, go to cPanel >> Domains and check the Document Root column. See this article for more information.

When you open the error_log file, check the last log in the file. Check the path to the file in the log:

  1. If you see this path: /home/cPuser/root_folder/wp-content/plugins/…/name_of_the_file.php, one of your plugins is causing the issue. Disable the plugin mentioned in the log.

    If you don’t have access to the WordPress dashboard, you can disable plugins by going to cPanel >> File Manager, Softaculous, or Terminal.

    An example of the error_log with the identifying component highlighted in bold:

    PHP Fatal error: Uncaught Error: Failed opening required '/home/nctest/nctest.com/wp-content/plugins/litespeed-cache/autoload.php' (include_path='.:/opt/alt/php81/usr/share/pear:/opt/alt/php81/usr/share/php:/usr/share/pear:/usr/share/php') in /home/nctest/nctest.com/wp-content/plugins/litespeed-cache/litespeed-cache.php:67

    The issue in the example is caused by the LiteSpeed Cache plugin, so this must be disabled to resolve the issue.

  2. If you can see this path: /home/cPuser/root_folder/wp-content/themes/…/name_of_the_file.php, your current theme is causing the issue. You can change your theme by going to the WordPress dashboard, website database, or Terminal.

    An example of the error_log with the identifying component highlighted in bold:

    PHP Fatal error: require(): Failed opening required '/home/nctest/nctest.com/wp-content/twentytwentythree/theme.json'

    This log shows that the issue is caused by the current website theme twentytwentythree.

  3. If you see one of the following paths, the issue is caused by one of the default WordPress files:

    - /home/cPuser/root_folder/name_of_the_file.php
    - /home/cPuser/root_folder/wp-admin/…/name_of_the_file.php
    - /home/cPuser/root_folder/wp-includes/…/name_of_the_file.php

    To resolve the issue, you can find out how to replace the default WordPress files.

    An example of the log you may see below:

    PHP Fatal error: Uncaught Error: Failed opening required '/home/nctest/nctest.com/wp-load.php' (include_path='.:/opt/alt/php81/usr/share/pear:/opt/alt/php81/usr/share/php:/usr/share/pear:/usr/share/php') in /home/nctest/nctest.com/wp-blog-header.php:13

    This error is caused by the wp-load.php file, which is a default WordPress file.


Enable WP_DEBUG mode


You can use the debug mode to check what caused the error. The mode can be enabled via the wp-config.php file in the root folder. Change the false value to true in the following line:

define('WP_DEBUG', false)

See more information on how to edit the wp-config.php file.


Increase the WordPress Memory Limit


If insufficient memory is causing the critical error then increasing the WordPress memory limit should resolve the issue. The limit can be increased by going to the wp-config.php file.

Add this line:

define('WP_MEMORY_LIMIT','512M')

Above this line:

/* That's all, stop editing! Happy publishing. */

As shown here:


You can change "512M" for the value you need. See this guide on how to increase WordPress memory limit.


Restore your website from a backup


If your website is still not working after you perform the steps above, you can restore a backup for your website. Use the Autobackup cPanel plugin if your hosting plan is Stellar Plus or Stellar Business.

For Stellar plans, follow these steps on how to restore cPanel backups. Contact our Support team in Live Chat or submit a Support Ticket if you need any assistance with the backup restoration.

We also recommend scanning your cPanel after you resolve the issue, as critical errors may be caused by malicious files.

Well done! Now you know how to resolve the most common WordPress error.



Don’t hesitate to contact our support team through chat/ticket if you have any questions.
Updated
Viewed
3857 times

Need help? We're always here for you.

notmyip