How to fix “There has been a critical error on this website” in WordPress
Seeing “There has been a critical error on this website” in WordPress? Find the plugin, theme or PHP problem behind it and get your site back.
Quick answer
This message means a PHP error stopped WordPress from loading. PHP is the programming language WordPress runs on, and the error almost always comes from a plugin, your theme or a PHP version change made by your host. Check the site admin email inbox first: WordPress usually sends a message that names the broken plugin or theme, with a recovery mode link that lets you log in and turn it off.
Why this happens
A plugin update or a new plugin
This is the most common cause. A plugin you just installed or updated has code that clashes with WordPress, your theme or another plugin, so WordPress stops loading the page.
Your theme, or code added to it
A theme update, or a snippet pasted into the theme’s
functions.phpfile, can break the site the same way. One missing bracket is enough.Your host upgraded PHP
Hosts move sites to newer PHP versions from time to time. Older plugins and themes that were never updated can stop working on the new version.
The site ran out of memory
Each page load gets a set amount of server memory. Heavy plugins, page builders or large imports can go over that limit, and the page stops with a fatal error.
An update that did not finish
If an update is cut off halfway, some files can be left half copied. The site stays broken until the update is run again or the files are replaced.
How to fix it, step by step
Step 1: Check your admin email for the recovery link
Since version 5.2, WordPress emails the site’s admin address when a fatal error happens. Look for a subject like “Your Site is Experiencing a Technical Issue”, and check your spam folder too.
The email names the plugin or theme that failed and includes a recovery mode link. Open the link and log in: WordPress pauses the broken plugin or theme so you can reach the dashboard. Go to Plugins, deactivate the one named in the email, then look for an update or a replacement. If no email arrives, carry on with the next step.
Step 2: Turn on the debug log
Open File Manager or connect with SFTP, and find
wp-config.phpin the main folder of your site. Look for the linedefine( 'WP_DEBUG', false );and replace it with the three lines below. They must sit above the line that says “That’s all, stop editing!”. The third line keeps the errors hidden from visitors.Save the file, reload the broken page once, then open
wp-content/debug.log. Near the bottom, find the line that contains “PHP Fatal error”. The folder path in it, such aswp-content/plugins/plugin-name/, tells you which plugin or theme failed.define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );Step 3: Turn off all plugins at once
If you cannot get into the dashboard, open
wp-contentin File Manager and rename thepluginsfolder toplugins-off. WordPress can no longer find the plugins, so none of them load. If the site now works, a plugin is the cause.Log in and open the Plugins page, where WordPress marks them all as deactivated. Then rename the folder back to
pluginsand activate the plugins one at a time, reloading the site after each one. When the error comes back, the last plugin you activated is the culprit. If the debug log already named a plugin, rename just that plugin’s folder instead.Step 4: Switch to a default theme
If plugins were not the cause, test the theme. In the dashboard, go to Appearance > Themes and activate a default WordPress theme such as Twenty Twenty-Four or Twenty Twenty-Five. If you cannot log in, check that one of those themes is in
wp-content/themes, rename your current theme’s folder, then log in and open Appearance > Themes. WordPress reports that the active theme is broken and switches to a default theme. If the error goes away, the problem is in your theme or in code added to it.Step 5: Check the PHP version
If the error started right after your host changed something, look at the PHP version in your hosting control panel (in cPanel it is under “MultiPHP Manager” or “Select PHP Version”). Update your plugins and theme first. If one of them has no update, switching back to the previous PHP version can get the site running while you replace it. Treat that as a short-term fix, because old PHP versions stop getting security updates.
Step 6: Raise the memory limit
If the debug log says “Allowed memory size of … bytes exhausted”, WordPress ran out of memory. Add the line below to
wp-config.php, above the “stop editing” line. Your host sets the real ceiling, so if nothing changes, ask them to raise the PHP memory limit. If memory errors keep coming back, one plugin is usually using far more than it should.define( 'WP_MEMORY_LIMIT', '256M' );Step 7: Restore a backup
If you still cannot find the cause, restore a backup from before the error started, using your host’s backup tool or your backup plugin. Restore the files and the database from the same date. Anything added after that date, such as new posts, form entries or orders, will be lost, so note those down first.
Step 8: Tidy up once the site works
Change
WP_DEBUGback tofalseinwp-config.phpand deletewp-content/debug.log. On many hosts anyone who knows the address of that file can open it, and it can show details about your server. Then update the plugin or theme that caused the problem, or replace it with one that is still maintained.
When to get help
Get help if you cannot reach your hosting files, if the debug log points to code you do not recognize, if the site is a shop taking orders, or if the error keeps coming back after you fix it. Dawnwire fixes a single WordPress error like this for a fixed $49.
Frequently asked questions
Has my WordPress site been hacked?
Usually not. This message is WordPress reporting a code error, most often from a plugin, a theme or a PHP change. If you also see admin users, files or pages you did not create, treat it as a possible hack and get help before you change anything else.
Why did I not get the recovery mode email?
The email goes to the admin address in Settings > General, which may be old or no longer checked. It can also land in spam, and some hosts do not send email from WordPress reliably. Once the site works, check that address, and consider an SMTP plugin, which sends WordPress email through a proper mail service.
Will I lose my content if I turn off all plugins?
No. Renaming the plugins folder only stops the plugins from running. Your posts, pages and media stay where they are, and most plugins keep their settings when they are deactivated. Deleting a plugin is different, so rename folders rather than delete them.
Can I leave WP_DEBUG turned on?
No. It is meant for finding a problem, not for a live site. Turn it off when you are done and delete wp-content/debug.log, because the log can often be opened by anyone who finds it and it can reveal details about your server.
Will reinstalling WordPress fix the critical error?
Rarely on its own. Reinstalling replaces the core files in wp-admin and wp-includes, but plugins and themes live in wp-content and are left as they are. It helps only when an update to WordPress itself was cut off halfway.