Fix the WordPress critical error
When WordPress shows "There has been a critical error on this website", or just a blank white page, a piece of PHP code has stopped with a fatal error. PHP is the programming language WordPress runs on. The cause is almost always a plugin, a theme, a PHP version change or a lack of memory. This guide shows how to find the cause and get the site working again. It is for site owners who can sign in to WordPress or connect to their files with SFTP.
Check your email for a recovery link
When WordPress catches a fatal error, it usually sends an email to the site's administration email address, with the subject mentioning a technical issue. The message names the plugin or theme that caused the error and contains a special link.
The link opens recovery mode: you can sign in to the dashboard while the faulty plugin or theme is paused for you only. Visitors still see the error until you fix it.
- Open the recovery link from the email and sign in.
- Follow the notice at the top of the dashboard to the plugin or theme that caused the error.
- Deactivate it, or update it if a fixed version is available.
- Exit recovery mode and check the site in a private browser window.
If no email arrives, check your spam folder. If your site cannot send email at all, or the address is out of date, continue with the steps below.
Turn on the debug log
WordPress can write errors to a log file so you can see exactly which file failed. Settings like this live in wp-config.php, in the site's main folder.
-
Download a copy of
wp-config.phpas a backup. -
Find the line
define( 'WP_DEBUG', false );. Replace it with these lines, above the line that says/* That's all, stop editing! */:define( 'WP_DEBUG', true );define( 'WP_DEBUG_LOG', true );define( 'WP_DEBUG_DISPLAY', false ); -
Reload the page that shows the error.
-
Open
wp-content/debug.log. Look at the most recent lines starting withPHP Fatal error. The file path in that line usually shows the culprit, for example a folder insidewp-content/plugins/orwp-content/themes/.
WP_DEBUG_DISPLAY set to false keeps the error messages out of the page, so visitors do not see technical details.
When you have fixed the error, set WP_DEBUG back to false, remove the two extra lines, and delete debug.log. A log left in place can grow large and may reveal details about your site.
Deactivate all plugins
If you cannot find the cause, rule out plugins as a group.
- Connect with SFTP and open
wp-content. - Rename the
pluginsfolder toplugins-off. - Reload the site. If it works, a plugin was the cause.
- Rename the folder back to
plugins. WordPress now shows all plugins as inactive. - Sign in and activate the plugins one at a time, checking the site after each. When the error returns, you have found the faulty plugin. Rename that plugin's own folder to deactivate it again.
Switch to a default theme
If plugins are not the cause, test the theme. In wp-content/themes, rename your active theme's folder, for example from example-theme to example-theme-off. WordPress falls back to an installed default theme, such as one of the "Twenty" themes. If none is installed, upload one from the wordpress.org theme directory first.
Check the PHP version
If the error started after the PHP version changed, a plugin or theme may not support the new version yet. Switch back to the previous version in your hosting settings, then update the plugin or theme, or replace it, before trying the newer version again. See PHP versions and settings.
Raise the memory limit
If the log says Allowed memory size of ... bytes exhausted, WordPress ran out of memory. You can raise the limit WordPress asks for by adding this line to wp-config.php:
define( 'WP_MEMORY_LIMIT', '256M' );
WordPress cannot use more memory than PHP allows, so this only helps if your hosting's PHP memory limit is at least as high. Repeated memory errors often point to a heavy plugin, which is worth fixing at the source.
Still not working?
Restore the backup from before the problem started. Then contact support with the exact error text from debug.log and what changed before it appeared.
Contact DomainPilot support with the support form. DomainPilot WordPress hosting includes daily backups, and plugin and theme updates with rollback from the WP Grow plan.