There has been a critical error on this website

PlatformWordPress Doing it yourself20 to 60 minutes if you can reach your files Checked

The short answer

WordPress hit a PHP error it could not recover from, so it stopped the page. It is almost always a plugin, the theme or a PHP version change, not lost content. Find the file named in the error log or the recovery email, switch that plugin or theme off, and the site comes back.

Is this your problem?

  • The message "There has been a critical error on this website"
  • A blank white page, sometimes only on some pages
  • wp-admin shows the same error, so you cannot log in
  • It started right after an update, or after the host changed PHP
  • The error appears only when you edit a page in a page builder

What usually causes it

1
A plugin update or a clash between two plugins

How to tell: It started right after an update. The recovery email names the plugin.

2
The host moved the site to a newer PHP version

How to tell: Nothing was updated on your side. The host sent a notice, or the PHP version in the host panel changed.

3
An edit to the theme, often functions.php

How to tell: Someone added code to the theme shortly before it broke.

4
The site ran out of memory

How to tell: The log says "Allowed memory size of ... bytes exhausted". Big pages or imports trigger it.

5
A half-finished core update

How to tell: The error names a file in wp-includes or wp-admin.

Before you touch anything

  • Take a backup of the files and the database first, or confirm your host has one from before the error started.
  • Write down what changed in the last day: updates, new plugins, edits, a host notice.

How to fix it, step by step

  1. 1

    Check your email for the recovery link

    Since WordPress 5.2 the site emails the admin address when this happens. The subject is "Your Site is Experiencing a Technical Issue". It names the plugin or theme and has a special link that logs you in with that plugin paused. Use it to deactivate the plugin, then update or replace it.

  2. 2

    Turn on the error log

    Open wp-config.php in your host file manager or over SFTP. Add these lines above the one that says "That is all, stop editing". The error is then written to wp-content/debug.log instead of the screen.

    define( "WP_DEBUG", true );
    define( "WP_DEBUG_LOG", true );
    define( "WP_DEBUG_DISPLAY", false );
  3. 3

    Read the last fatal error

    Open wp-content/debug.log and look for the newest line that starts with "PHP Fatal error". The file path in it tells you who is at fault: wp-content/plugins/NAME is a plugin, wp-content/themes/NAME is the theme.

  4. 4

    Switch the plugin off without logging in

    In the file manager, rename the plugin folder, for example wp-content/plugins/NAME to NAME-off. WordPress deactivates it. If you cannot tell which plugin it is, rename the whole plugins folder to plugins-off, check the site loads, rename it back, and then turn plugins back on one at a time in wp-admin.

  5. 5

    If it is the theme

    Rename the active theme folder. WordPress falls back to a default theme, as long as one such as Twenty Twenty-Four is still installed. If none is installed, upload one first.

  6. 6

    If the host changed PHP

    Switch back to the previous PHP version in the host panel to get the site up, then update the plugin or theme that is not ready for the newer version and switch forward again. Staying on an old PHP version is a security risk, so treat it as a stopgap.

  7. 7

    If it ran out of memory

    Raise the WordPress memory limit in wp-config.php. Your host may cap it lower, in which case ask them to raise the PHP memory_limit.

    define( "WP_MEMORY_LIMIT", "256M" );
  8. 8

    Turn the log off again

    When the site works, set WP_DEBUG back to false or remove the lines, and delete debug.log. Left on, the log file can reveal file paths to anyone who finds it.

Stop and get help if

  • The log names files you do not recognise, in wp-content/uploads or wp-content/mu-plugins, or code full of base64 and eval. That points to a hack, not a bad update.
  • The site is a shop taking orders and every hour it is down costs money.
  • There is no backup and the error names WordPress core files.
Fix it for me

Stop it happening again

  • Test updates on a copy of the site before they go live.
  • Update one plugin at a time and check the site after each one.
  • Keep a daily backup you have actually restored once.
  • Keep PHP on a version that still gets security fixes.

Questions people ask

Have I lost my content?

No. Pages, posts and orders live in the database. The error stops pages being shown, it does not delete them.

I never got the recovery email. Why?

The admin email address in WordPress may be old, or the site cannot send email at all. The fix for that is on our page about WordPress emails not sending.

Is a critical error a sign of a hack?

Usually not. It is usually an update or a PHP change. It is worth a look if the log names files you did not add.

Where is the error log if debug.log is empty?

Many hosts keep their own PHP error log. In cPanel it is under Metrics, then Errors, or in a file called error_log in the site folder.

Still broken? We can fix it.