PHP & WordPress
“There Has Been a Critical Error on This Website”: How to Fix It in WordPress
“There has been a critical error on this website” is how WordPress reports a PHP fatal error: some code stopped running, so WordPress shows a short message instead of a blank white page. It usually appears right after a plugin, theme, WordPress or PHP update. The message hides the details from visitors, so the first job is to find out which file failed. This guide goes from the quickest checks to the last resorts.
Related service: Website maintenance & support
By WebsNexus · November 1, 2026 · 5 min read · Updated November 1, 2026
Part of Fix-it library
Common causes, as they appear in the error log
| What the log says | Likely cause | Fix |
|---|---|---|
| Allowed memory size of … bytes exhausted | A plugin or import needs more PHP memory than allowed | Raise WP_MEMORY_LIMIT, or find the plugin using the memory |
| Call to undefined function … | A plugin relies on a function that was removed or isn’t loaded | Update or replace the plugin; check the PHP version |
| Uncaught TypeError / ArgumentCountError | Old code running on PHP 8, which is stricter | Update the plugin or theme, or temporarily return to the previous PHP version |
| Cannot redeclare … | Two plugins, or two copies of one, define the same function | Deactivate the duplicate |
| Failed opening required … wp-includes/… | Missing or corrupted WordPress core files | Re-download WordPress core |
What does “There has been a critical error on this website” mean?
It means PHP hit a fatal error while building the page, and WordPress’s fatal error handler caught it. WordPress has done this since version 5.2: rather than a white screen, it shows a short notice and emails the site administrator a link to recovery mode. Your content and database are not lost; the code that displays them has stopped.
The error can affect the whole site, only wp-admin, or a single page, depending on where the faulty code runs.
How do you use the WordPress recovery-mode email?
When the error happens, WordPress emails the site’s admin email address with the name of the plugin or theme that failed and a special recovery-mode link. Open the link and log in. In recovery mode the faulty plugin or theme is paused, but only for you; visitors still see the error until you fix it.
From the dashboard, deactivate the plugin that is named, or switch to another theme, then exit recovery mode. Check your spam folder if the email doesn’t arrive. If the admin email address is old or the site can’t send email, skip to the next step.
How do you turn on WordPress debug logging?
Turn on debug logging by adding three lines to wp-config.php, above the line that says “That’s all, stop editing!”. WordPress then writes every error to wp-content/debug.log without showing it to visitors. Reload the broken page and open debug.log: the last “PHP Fatal error” line names the file and line that failed, and the folder in that path tells you which plugin or theme it belongs to.
When you have fixed the problem, set WP_DEBUG back to false and delete debug.log, because it can expose details about your server.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );How do you deactivate plugins without access to wp-admin?
Deactivate all plugins at once by renaming the wp-content/plugins folder to something like plugins-off, using your host’s file manager or SFTP. WordPress can no longer find the plugins and deactivates them. If the site loads, rename the folder back and reactivate plugins one by one from the dashboard until the error returns. The last one you turned on is the cause.
With SSH access, WP-CLI does the same in one command, and can deactivate a single plugin by its folder name.
wp plugin deactivate --all
# or only the plugin named in debug.log:
wp plugin deactivate plugin-folder-nameHow do you rule out the theme?
If deactivating plugins didn’t help, switch to a default WordPress theme such as Twenty Twenty-Five. Without wp-admin, rename your active theme’s folder in wp-content/themes and WordPress falls back to an installed default theme. With WP-CLI, run wp theme activate twentytwentyfive. If the site loads, the error is in your theme or a child theme’s functions.php.
Did your PHP version just change?
Many critical errors start when the host upgrades PHP. PHP 8 removed old functions such as create_function() and each() and turned many warnings into errors, so plugins and themes written for PHP 7 can crash. Check the PHP version in Tools, then Site Health, then Info, or in your hosting panel.
The right fix is to update or replace the plugin that fails. Switching back to an old PHP version is only a short-term step: PHP 8.1 and older no longer get security fixes. Our PHP supported-versions page lists which versions are still safe.
How do you fix “Allowed memory size exhausted”?
Raise the memory WordPress asks PHP for by setting WP_MEMORY_LIMIT in wp-config.php. By default WordPress tries to set 40MB for a single site and 64MB for multisite. Your host’s PHP memory_limit is the ceiling: if WordPress asks for more than the host allows, ask the host to raise it.
If the error comes back after raising the limit, a plugin is probably stuck in a loop or loading too much data. debug.log shows which file was running when memory ran out.
define( 'WP_MEMORY_LIMIT', '256M' );What if WordPress core files are damaged?
If the log points to files in wp-admin or wp-includes, core files may be missing or modified, for example after a failed update or a hack. WP-CLI can check them against the official checksums and re-download core without touching wp-content, where your themes, plugins and uploads live.
If core files were modified without your knowledge, treat it as a possible compromise: change all passwords and get the site checked, not just repaired.
wp core verify-checksums
wp core download --skip-content --forceWhen should you restore a backup?
Restore a backup when you can’t find the cause quickly and the site must be back online. Restore the most recent backup from before the error started, then repeat the update that caused it on a staging copy. Without a backup, a developer can usually still recover the site from the files and database.
Frequently asked questions
Will I lose my content because of the critical error?
No. Posts, pages, orders and settings are stored in the database, which the error doesn’t touch. Once the faulty code is fixed or disabled, the content shows again.
Why didn’t I get the recovery-mode email?
WordPress sends it to the admin email address in Settings, then General. It won’t arrive if that address is out of date, if the server can’t send email, or if it went to spam. Use debug logging instead.
Is the critical error caused by a hack?
Usually not: most come from updates or incompatible plugins. But if core files were changed or you see unknown admin users or files, treat it as a possible compromise and have the site checked.
Can I fix the critical error without FTP?
Yes, if you get the recovery-mode email. Without it you need some file access: your host’s file manager in cPanel or Plesk works as well as FTP or SSH.
Why did the error start after an update?
An update can bring code that needs a newer PHP version, clash with another plugin, or fail halfway. Test updates on a staging copy first and keep a backup from before each update.
Should I leave WP_DEBUG on?
No. Turn it off and delete wp-content/debug.log once the site works, because the log can reveal file paths and other details about your server.
Sources
Related articles
- “Error Establishing a Database Connection” in WordPress: How to Fix It
Fix “Error establishing a database connection” in WordPress: check wp-config.php credentials, confirm MySQL is running and repair damaged tables.
- How to Check Your PHP Version (cPanel, WordPress, CLI) and Whether It Is Safe
Check your PHP version in cPanel, WordPress Site Health, the command line or phpinfo(), then see which PHP versions are safe and patched for PHP2Shell.
- Is Your Website Safe From the Latest Attacks? A PHP and WordPress Security Audit Checklist
A practical security audit checklist for PHP and WordPress websites after PHP2Shell and 2026’s WordPress attacks: what to check, signs of a hack and costs.
- PHP2Shell (CVE-2026-109618 and CVE-2026-109619): Is Your Website Affected and What to Do Now
PHP2Shell lets attackers run code on PHP servers without logging in. Check if your site is affected, which PHP versions are patched, and what to do today.