Back to Blog

There Has Been a Critical Error on This Website: How to Fix It

WordPress says There has been a critical error on this website? Find the PHP error with WP_DEBUG, disable plugins or the theme and fix memory limits.

Nodesty Team8 min readHosting
The words Critical Error with WP_DEBUG, plugins and PHP on a dark Nodesty background

There has been a critical error on this website is the message WordPress shows when PHP crashes while building the page. Instead of your site, visitors see a single sentence, and sometimes you can't even reach wp-admin. The cause is almost always a plugin, the theme, the PHP version or a memory limit, and you can find it in a few minutes once you know where to look.

This guide covers what the message means, the recovery mode email, finding the real error with WP_DEBUG, disabling plugins and the theme without wp-admin, PHP version and memory problems, failed updates, damaged core files and turning debugging off again afterwards.

What does the message mean?

Every page load runs PHP code from WordPress core, the active plugins and the theme. If any of it triggers a fatal error, such as a call to a function that doesn't exist or running out of memory, PHP stops. Since WordPress 5.2, WordPress catches the error and shows "There has been a critical error on this website" instead of a blank page. On a site set to Turkish the message reads "Bu sitede kritik bir hata oluştu.", in German "Es gab einen kritischen Fehler auf deiner Website."

Before 5.2, or when the error happens before WordPress can catch it, you get the white screen of death: a completely blank page, often with an HTTP 500 status. The causes and fixes are the same. If the site instead says "Error establishing a database connection", the problem is the database, not PHP; see our Error establishing a database connection guide.

Check the recovery mode email

When the error occurs, WordPress sends an email to the site's admin address with a subject like "Your Site is Experiencing a Technical Issue". The email names the plugin or theme that caused the error and contains a special login link.

Through that link you log in to recovery mode: the faulty plugin or theme is paused only for your session, so wp-admin works while visitors still see the error. Deactivate or update the plugin named in the email, then choose Exit Recovery Mode. The link is valid for a limited time; if it has expired, a new email is sent the next time the error occurs.

If the email never arrives because the site can't send mail or the admin address is outdated, use the steps below.

Find the real error: WP_DEBUG and debug.log

The message on the screen tells you nothing about the cause; the real error is in the logs. Open wp-config.php in your site's root folder (usually public_html) with the control panel's file manager or over SFTP and replace the existing WP_DEBUG line with these lines, above /* That's all, stop editing! */:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Reload the page that shows the error and open wp-content/debug.log. The error you're looking for starts with PHP Fatal error, and the file path in it shows the culprit:

PHP Fatal error:  Uncaught Error: Call to undefined function create_function() in /home/cpuser/public_html/wp-content/plugins/old-slider/slider.php:42

Here the plugin is old-slider. A path under wp-content/themes/ points to the theme, a path under wp-includes or wp-admin usually to core files or a PHP problem. Over SSH you can follow the log live with tail -f wp-content/debug.log.

If debug.log stays empty, look at the PHP log: cPanel writes an error_log file in the site folder and shows the web server log on the Errors page; DirectAdmin offers the domain's error log in the panel.

Common errors and their causes

Message in the logLikely cause
Allowed memory size of ... bytes exhaustedPHP memory limit too low or a heavy plugin
Call to undefined function ...PHP version mismatch or a missing extension
syntax error, unexpected ...A broken edit, often in functions.php
Failed opening required ... wp-includes/...Missing or damaged core files
Cannot redeclare ...Two plugins, or two copies of the same plugin
Maximum execution time of 30 seconds exceededA slow operation, such as an import or backup

If you see a syntax error right after editing functions.php in the theme editor, open the file over SFTP and undo the change.

Disable plugins without wp-admin

Most critical errors come from a plugin, often right after an update. If the log names a plugin, rename only that plugin's folder in the file manager, for example from wp-content/plugins/old-slider to old-slider.off. WordPress can't find the plugin and deactivates it.

If you don't know which plugin it is, disable all of them by renaming wp-content/plugins to plugins.off. If the site opens, rename the folder back to plugins and reactivate the plugins one by one under Plugins; the one that brings the error back is the culprit. Settings are stored in the database, so nothing is lost.

With SSH and WP-CLI it's faster. --skip-plugins and --skip-themes keep WP-CLI from loading the faulty code itself:

cd ~/public_html
wp plugin list --skip-plugins --skip-themes
wp plugin deactivate old-slider --skip-plugins --skip-themes
wp plugin deactivate --all --skip-plugins --skip-themes

Switch to a default theme

If the log points to wp-content/themes/, the theme is the culprit. Rename the active theme's folder, for example wp-content/themes/mytheme to mytheme.off, and WordPress falls back to a default theme such as Twenty Twenty-Five. This only works if a default theme is installed; if not, upload one into wp-content/themes first. With WP-CLI:

wp theme install twentytwentyfive --activate --skip-plugins --skip-themes

If you use a child theme, check its functions.php first; a small custom snippet is a more common cause than the parent theme.

PHP version incompatibility

If the error appears right after a PHP version change, or an old plugin calls functions that were removed in PHP 8 such as create_function() or each(), the PHP version is the cause. Switch back to the previous version from the panel to bring the site back, then update or replace the plugin before trying the newer version again. Our How to change PHP version guide shows how in cPanel and DirectAdmin. Errors like Call to undefined function mysqli_connect() instead point to a PHP extension that isn't enabled.

Allowed memory size exhausted

The message Allowed memory size of 134217728 bytes exhausted means a script hit the PHP memory_limit, here 128 MB. WordPress has its own limit, which you can raise in wp-config.php:

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

WP_MEMORY_LIMIT can't go above the PHP memory_limit, so raise that as well if needed: in cPanel with the MultiPHP INI Editor or Select PHP Version → Options, in DirectAdmin in the PHP settings. If the error continues even with a high limit, a plugin is wasting memory; find it with the steps above instead of raising the limit further.

A failed update and the .maintenance file

During an update WordPress creates a .maintenance file in the site's root folder. If the update is interrupted, the file stays and the site shows "Briefly unavailable for scheduled maintenance. Check back in a minute." Delete it in the file manager (enable showing hidden files) or over SSH:

rm ~/public_html/.maintenance

Then check under Dashboard → Updates that the update has really finished. A plugin whose update was cut off half way can trigger the critical error; reinstall it.

Damaged core files

If the error is in wp-includes or wp-admin, core files may be missing or damaged after a failed update or a broken upload. Check them and reinstall core without touching wp-content or wp-config.php:

wp core verify-checksums --skip-plugins --skip-themes
wp core download --version=$(wp core version) --skip-content --force

Without SSH, download the same WordPress version from wordpress.org, unzip it on your computer and upload only the wp-admin and wp-includes folders over SFTP, overwriting the old ones. Never overwrite wp-content. If verify-checksums reports files you never changed, the site may be hacked; see our Website hacked: what to do guide.

Restore from a backup

If you can't find the cause, or several things broke at once, restoring the files and database from before the error is the quickest way back. In the panel you can restore a backup with JetBackup or a similar tool; our Server backups guide covers what a good backup routine looks like. After restoring, update the plugins one at a time, not all at once, so you can see which one causes the error.

Turn debugging off afterwards

Once the site works again, set WP_DEBUG back to false in wp-config.php, remove the extra lines and delete wp-content/debug.log. The log contains file paths and sometimes data that shouldn't be public, and a visible error output tells attackers a lot about your site. If you see other errors along the way, our HTTP error codes guide explains what 500, 502 and 503 mean.

WordPress at Nodesty

Nodesty web hosting runs WordPress sites on AMD Ryzen 9 7900 servers with the LiteSpeed web server and NVMe storage. You change the PHP version and memory_limit, read the error log and edit files from cPanel or DirectAdmin, and with JetBackup you can restore a working copy of your site from the panel. If you want full control, our AMD Ryzen 9 9950X VPS plans give you full root access and free daily backups kept for 7 days. A fresh installation is covered in our How to install WordPress guide.

Frequently Asked Questions

What does There has been a critical error on this website mean?

It means PHP hit a fatal error while loading WordPress, a plugin or the theme, and had to stop. Since WordPress 5.2, WordPress catches that error and shows this message instead of a blank page. The real error message is written to the logs, and the site's admin email address usually receives an email with a recovery link.

Is my content lost?

No. Posts, pages and settings are in the database, and a critical error doesn't delete them. The problem is in the PHP code that runs the site, most often a plugin, the theme or a PHP setting. Once the faulty code is disabled or fixed, the site comes back as it was.

I didn't receive the recovery mode email. What now?

The email goes to the address in Settings, General, and it is often lost if the site can't send mail or the address is old. You don't need it; enable WP_DEBUG_LOG to find the error, or disable the faulty plugin by renaming its folder with the file manager or over SFTP.

Will I lose plugin settings if I rename the plugins folder?

No. Plugin settings are stored in the database, not in the folder. WordPress only deactivates plugins whose files it can't find. When you rename the folder back and reactivate the plugins one by one, their settings are still there.

Is it safe to leave WP_DEBUG enabled?

No. With WP_DEBUG_DISPLAY on, error messages and file paths are shown to visitors, and a debug.log that keeps growing in wp-content can be downloaded by anyone who guesses the address. Turn WP_DEBUG off and delete debug.log as soon as you have found the problem.

What is the white screen of death?

It is a completely blank page with no message. It appears when a PHP fatal error occurs and error display is off, for example on older WordPress versions or when the error happens before WordPress can catch it. The causes and the fixes are the same as for the critical error message.

Nodesty

About the author

Nodesty Team · Infrastructure & Support

The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.

Related articles

Launch your server now.

Build, scale, and conquer without limits on Nodesty's premium infrastructure.

                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                             ············································                                                   
                                                ··································································································..........···························                                     
                                       ················..........................................................................................................................··············                             
                                  ·············.................::::::::::::::::::::::::::::::::::::::::::::::....................:::::::::::::::::::::::::::::::::::::::................···········                        
                             ············................:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::............·········                     
                         ············.................:::::::::::::::::::::::::::::::::::::::::::::::::::------------::::::::::::::::::::::::::::::----------------:::::::::::::::::::::..........········                  
                    ············......................::::::::::::::::::::::::::::::::::::------------------------------------------------------------------------------------:::::::::::::.........········                
                ··········.............................................::::::::::::::::::-------------==========================================-----------------------------------:::::::::::........·······               
             ········..................:.....................................::::::::::--------=======+++++++++++++++++++++++++++++++++++++=========================------------------::::::::::.......·······              
           ······.........::::::::::::::::::::................................:::::::-----=====++++xxxxxx**************************xxxxxxxxx++++++++++++++===================------------::::::::.......·······             
          ·····.......:::::::::::::::::::::::::::.............................:::::----===+++xxx****%%%%&&&&&&#############&&&&&&&%%%%%*******xxxxxxxx++++++++++++++==============----------:::::::......······             
         ····......::::::::-------------:::::::::::..........................::::---===+++xx***%%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@####&&&&&%%%%*******xxxxxxxxx+++++++++++++===========--------::::::......·····             
        ····.....:::::::--------------------:::::::::.......................::::---===++xxx**%%&&&###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&%%%%%********xxxxxxxxxxx++++++++++++========------::::::.....······            
        ····.....:::::--------------------------::::::::....................::::---===++xx***%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&&%%%%%**********xxxxxxxxxxxxx+++++++++=======------:::::.....·····            
        ····....::::::-------=============---------:::::::::................:::::---===+++xx***%%%&&&#####@@@@@@@@@@@@@@@@@@@@@@@@@#####&&&&&%%%%%%*************xxxxxxxxxxxxxx+++++++++======-----:::::....·····            
         ····....:::::-------================---------:::::::::...............:::::----===++++xxx***%%%%&&&&&&#################&&&&&&%%%%%%%*******************xxxxxxxxxxxxxxxxx++++++++======----:::::....·····            
         ·····....:::::--------=================---------::::::::::..............:::::::-----====+++++xxxxxx**************************xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx++++++++=====-----::::....·····            
          ·····.....:::::--------=================----------:::::::::::.................:::::::::-------=============++++++++++++++++++++++++++++++++++++xxxxxxxxxxxxxxxxxxxxxxx++++++++======-----::::....·····            
            ·····.....:::::::----------===========-------------::::::::::::.........................::::::::::::::::::------------------=============+++++++++++++++++++++++++++++++++=======-----::::.....·····            
              ······......:::::::---------------------------------:::::::::::::........................................:::::::::::::::-----------============+++++++++++++++++++++========------:::::.....·····             
                 ······........:::::::::---------------------------:::::::::::::::::...........................................:::::::::::::------------=============================--------::::::.....······              
                    ·········.........:::::::::::::::-------------::::::::::::::::::::::::.......................................::::::::::::::::--------------------------------------::::::::......·······                
                          ··········............::::::::::::::::::::::::::::::::::::::::::::::::::................................::::::::::::::::::::::::::-------------:::::::::::::::.........········                   
                                  ············..................:::::::::::::::::::::::::::::::::::::::::::.........................:::::::::::::::::::::::::::::::::::::................···········                        
                                             ················.............................................................................................................·················                                 
                                                           ······················................................................................···························                                                
                                                                               ·········································································