Skip to content
S-02

WordPress shows an error

A critical error, a white screen, a database error or a login loop.

Do this first

Your first three moves

  1. Check the admin email inbox for the recovery mode email from WordPress. Its link pauses the plugin or theme that crashed.
  2. No email? Rename the suspect folder in wp-content/plugins over SFTP, or run: wp plugin deactivate --all --skip-plugins
  3. Set WP_DEBUG and WP_DEBUG_LOG to true in wp-config.php, reload once, and read the last fatal error in wp-content/debug.log.

Diagnose it

Work out what is really wrong

What you are seeing

WordPress errors read alike but point to very different problems. Match the exact text first.

MessageWhat it means
There has been a critical error on this website.A PHP fatal error, caught by the WordPress error handler (since version 5.2). The real error is in the log.
A blank white pageA fatal error with error display off, often memory exhaustion or a crash before the handler loads.
Error establishing a database connectionWordPress cannot log in to MySQL or MariaDB.
Briefly unavailable for scheduled maintenance. Check back in a minute.An interrupted update left a .maintenance file in the site root.
Allowed memory size of 268435456 bytes exhaustedPHP hit its memory limit (268435456 bytes is 256 MB).
Maximum execution time of 30 seconds exceededA request ran longer than PHP allows.
Sorry, you are not allowed to access this page. after a migrationThe user roles no longer match the database table prefix.
Updating failed. The response is not a valid JSON response.The block editor cannot reach the REST API.
The link you followed has expired. on uploadThe file is larger than upload_max_filesize or post_max_size.
Another update is currently in progress.A stale update lock is still in the database.
Login page reloads with no errorA login loop: cookie, URL or HTTPS mismatch.

Confirm it in two minutes

These checks run in an SSH terminal, inside the site’s folder (the one that contains wp-config.php). Your hosting panel shows the SSH login details.

1. Find out whether WordPress itself loads.

wp core version
wp core version --skip-plugins --skip-themes

--skip-plugins and --skip-themes load WordPress without any plugin or theme code. If the first command prints the same fatal error and the second prints a version number, a plugin or the theme is the cause, not core.

2. See what changed most recently.

ls -lt wp-content/plugins wp-content/themes | head -n 15

-lt sorts by last modified time, newest first. The folder at the top whose date matches when the error started is your first suspect.

3. Check the memory limit WordPress actually gets.

wp eval 'echo ini_get("memory_limit"), " / ", WP_MEMORY_LIMIT, "\n";'

The first number is the PHP limit set by the server, the second is the limit WordPress asks for. WordPress cannot go above the server value. If the error says memory exhausted and these show 128M or less, memory is a real candidate.

4. Test the REST API, for the JSON error.

curl -s -o /dev/null -w '%{http_code}\n' https://example.com/wp-json/

Run this one on your own computer, replacing example.com with your domain. Good: 200. A 403 means a security plugin or firewall blocks it; a 404 means the rewrite rules are broken (resave Settings, Permalinks).

5. Check the database.

wp db check

Good: every table reports OK. A table marked as crashed explains database errors on some pages but not others.

Most likely causes, in order

  1. A plugin or theme update that is incompatible. Tell: the fatal error’s file path runs through wp-content/plugins/PLUGIN_NAME/ or wp-content/themes/THEME_NAME/, and the time matches an update. Fix: disable that plugin or roll it back to the previous version, then report it to the developer.
  2. The host changed the PHP version. Tell: errors like Call to undefined function create_function() or each(), both removed in PHP 8.0, with no update on your side. Fix: update or replace the old code. Switch PHP back only as a short stopgap, because older versions stop getting security fixes.
  3. Memory exhaustion. Tell: Allowed memory size ... exhausted. The file named is where memory ran out, not always what used it. Fix: set define( 'WP_MEMORY_LIMIT', '256M' ); in wp-config.php. If it still runs out at 512 MB, find the leak instead of raising the limit again.
  4. A code edit. Tell: PHP Parse error: syntax error, unexpected with a file and line number, often functions.php or a snippets plugin. Fix: undo the edit over SFTP. Editing in the dashboard gives you no way back if it breaks.
  5. An interrupted update. Tell: the maintenance message, an empty plugin folder, or Another update is currently in progress. Fix: delete .maintenance from the site root; clear the lock with wp option delete core_updater.lock; reinstall the half-updated plugin.
  6. A login loop after a move to HTTPS or a new domain. Tell: correct password, then straight back to wp-login.php. Fix: make the WordPress Address and Site Address match the real URL exactly, check any COOKIE_DOMAIN line in wp-config.php, and exclude wp-login.php from caching.
  7. A changed table prefix after a migration. Tell: you can log in but see "not allowed". Fix: the option PREFIX_user_roles and the user meta keys PREFIX_capabilities must use the same prefix as $table_prefix in wp-config.php.
  8. Wrong file ownership. Tell: updates ask for FTP details, or Could not create directory. Fix: ask your host to set ownership to the site’s user. Avoid setting folders to 777.

What it usually is not

  • Broken WordPress core. Reinstalling core rarely helps. If wp core verify-checksums passes, core is fine.
  • Your host, when the log names a plugin. A fatal error inside a plugin’s folder is that plugin’s code failing, even if the host made the change that exposed it.
  • Not enough memory, every time. Raising the limit to 1 GB hides a leak until traffic grows.

What to send your host

  • The exact error text and the URL, with the time in UTC.
  • The full fatal error line from the log, including file path and line number.
  • The PHP version before and after, and whether the host changed it recently.
  • What was updated or edited, and when.
  • The output of the checks above.
  • Whether the error appears on every page, only in the admin, or only for logged-in users.

The full fix

Field guides for this symptom

FG-61 Migrations & backups

How to Recover a WordPress Site With No Backup

No backup? Check host snapshots, CDN caches, the Wayback Machine and old copies first, then rebuild from feeds and uploads, or rescue a database MySQL will not start.

Read the guide
16 min read

Search the field manual

What is going wrong?

Press / to search from any page, Esc to close