WordPress error messages are written by six different layers, and the layer that wrote the message tells you which fix to try first.
A blank page, a 502, a critical error and a database connection error all look like the same disaster. Each one comes from a different program.
The sections below match every message to its author, then give you three file-level tests that isolate the cause without deleting a single file.
TL;DR
- Each WordPress error message is written by one layer, and the author of the message decides the first test to run.
- A Cloudflare-branded 502 or 504 means your origin server sent that status, while an unbranded blank 502 or 504 came from Cloudflare.
- A critical error or blank page is a PHP fatal error, and three constants in wp-config.php write it to wp-content/debug.log.
- Recovery mode pauses the faulty plugin or theme for one browser only, so visitors keep seeing the error.
- WordPress asks PHP for 40 MB on a single site by default, and raising that limit can hide the real fault.
- WordPress.org recommends PHP 8.3 or greater, and PHP 7.4 has passed its end of life.
- Versions: These steps are for self-hosted WordPress 7.1 on PHP 8.3.
- You need: An FTP client or your host's file manager, plus access to the admin email inbox.
- Back up first: Copy
wp-config.phpand.htaccessto your computer before you edit either one. - Rule out first: Open the site in a private window, because a cached copy can keep showing an error after the cause is fixed.
WordPress Error Messages by Layer: Who Wrote What
Six layers sit between a visitor and your content, and each one writes its own kind of error. The table matches the message on your screen to its author and the first test to run.
| Layer | What you see | Who wrote it | First test |
|---|---|---|---|
| Browser | DNS_PROBE_FINISHED_NXDOMAIN or another browser error page | Your browser, because the request never reached WordPress | Open the site on mobile data or another device |
| CDN | A Cloudflare error page with a 52x code such as 521 or 524 | Cloudflare | Send the code, the time and the URL to your host |
| Web server | A plain 500, 502, 503 or 504 page | Apache, Nginx or a proxy in front of PHP | Rename .htaccess on Apache, then read the server log |
| PHP | A blank page, or "There has been a critical error on this website" | PHP, caught by WordPress's fatal error handler | Rename the plugins folder |
| WordPress | "Updating failed" or "Briefly unavailable for scheduled maintenance" | WordPress itself | Save Settings → Permalinks, or delete .maintenance |
| Database | "Error establishing a database connection" | WordPress, after the database refused it | Check the four DB_ values in wp-config.php |
A plain 500 can come from the web server or from PHP, so the first test for it is a rename, not a guess.
Cloudflare gives the same advice for most 5xx errors in its documentation: contact your hosting provider or site administrator first, and gather data before you change anything.
A Blank Page Is a Hidden PHP Fatal Error
A blank white page, known as the white screen of death, means PHP stopped on a fatal error and nothing printed the reason.
WordPress's documentation adds that database errors can also show up as a white screen.
Since WordPress 5.2, the fatal error recovery mode catches most of these crashes and prints "There has been a critical error on this website." instead.
The handler emails the admin address a secret link, and clicking it sets a cookie that pauses the faulty plugin or theme for that browser only.
Recovery mode repairs nothing for your visitors. They keep seeing the error until you deactivate, update or delete the extension for everyone.
When no email arrives, the ExplainWP fix for the critical error message covers the admin address, mail delivery and the file routes.
The WP_DISABLE_FATAL_ERROR_HANDLER constant turns the handler off, and the wp-config.php documentation shows it set to true only in a development example.
On a site that has it set to true, a crash falls back to PHP's own behavior, which is often a blank page.
Search wp-config.php for the constant before you debug further.
The 3 Isolation Tests That Work on Any Layer
Three file-level tests separate a plugin fault from a theme fault from a code fault, and none of them deletes anything.
Run them in order, and stop at the first one that brings the page back.
Test 1: Rename the Plugins Folder to Switch Off Every Plugin
- Connect with an FTP client or open your host's file manager, then open the
wp-contentfolder. - Rename
pluginstoplugins.hold. WordPress's documentation usesplugins_old, and any name other thanpluginsworks. - Reload the failing page in a private window. If it loads, a plugin caused the fault.
- Log in to wp-admin and rename the folder back to
plugins. Open Plugins → Installed Plugins, where every plugin now shows as deactivated. - Activate one plugin at a time and reload the failing page after each. The activation that brings the error back names the culprit.
If the error never left in step 3, rename the folder back and move to Test 2.
Test 2: Rename the Active Theme Folder to Force a Default Theme
- Open
wp-content/themesand confirm a default theme is installed. Upload one from the WordPress.org theme directory if the folder holds only your own theme. - Rename the active theme's folder, for example
mythemetomytheme.hold. - Reload the failing page. WordPress can fall back to an installed default theme, so the site should load with a different design.
If the error is gone, the theme or its functions.php caused it.
A pasted snippet with a missing semicolon, a missing bracket or curly quotation marks is the usual trigger, according to the WordPress documentation on syntax errors.
Test 3: Write the Hidden Error to a Log File
A blank page hides the cause, so make WordPress write it to a file instead.
WordPress's debugging documentation gives three constants for this. WP_DEBUG is false by default, WP_DEBUG_LOG writes errors to wp-content/debug.log, and WP_DEBUG_DISPLAY controls whether they print on the page.
Add these lines to wp-config.php above the comment that says "That's all, stop editing!":
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Reload the broken page once. The file wp-content/debug.log appears, and its last "PHP Fatal error" line carries a file path.
The folder name after wp-content/plugins/ or wp-content/themes/ in that path names the culprit.
Remove it afterwards: The debugging documentation says WP_DEBUG and the other debug tools are meant for local testing and staging installs, not live sites. Delete the constants and the debug.log file when you finish, because an error log in a publicly accessible location is a security risk.
Four log lines cover most of what you will read there:
| What debug.log says | What it means | Go to |
|---|---|---|
| Allowed memory size of XXXXX bytes exhausted | A script used up PHP's memory | Raise Memory and Time Limits Last, Not First |
| Maximum execution time of 30 seconds exceeded | A script hit PHP's time limit | Raise Memory and Time Limits Last, Not First |
| Call to undefined function | A plugin or theme calls code that is missing or incompatible | Test 1 or Test 2 |
| Parse error: syntax error | A typo in a PHP file, often a pasted snippet | Fix or remove the snippet |
Is a 500 Internal Server Error Your Fault or Your Host's?
A 500 Internal Server Error is a catch-all, and MDN lists improper server configuration, out-of-memory conditions, unhandled exceptions and improper file permissions among its causes.
WordPress's documentation names a corrupted .htaccess file as the most likely culprit on a WordPress site. Test it first, because the test is a single rename.
- Open the folder that holds
wp-config.php, and switch on your FTP client's setting for hidden files, because.htaccessstarts with a dot. - Rename
.htaccessto.htaccess_old. - Reload the site in a private window. If the page loads, the old file was the cause. If the 500 stays, rename the file back.
- Log in, open Settings → Permalinks, and click Save Changes without changing anything. WordPress writes a fresh
.htaccessfile.
If wp-admin will not load yet, create a new file named .htaccess in the same folder and paste the default block that WordPress writes for pretty permalinks on a standard single site:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Reload the site. A working home page confirms the rules were the problem.
The new file lacks any redirects or rules that other plugins added to the old one.
Open .htaccess_old and copy those blocks back one at a time, reloading after each, so the block that breaks the site shows itself.
If the 500 survives the rename, WordPress's documentation lists the next suspects in order: plugins, the active theme, the PHP memory limit and damaged core files.
Damaged core files are replaced by uploading fresh wp-admin and wp-includes folders from a clean download. The ExplainWP guide to the WordPress 500 internal server error puts those tests in one ordered list.
WordPress's debug log only records errors that happen after WordPress has loaded, so an empty log after the three tests points at the server layer.
Why 502 and 504 Gateway Errors Start Behind WordPress
A 502 Bad Gateway means a gateway or proxy received an invalid response from the server behind it, and a 504 Gateway Timeout means it received no timely response.
Both codes come from the program in front of PHP, usually Nginx, Apache or Cloudflare, so the fault sits one layer behind the page you see.
Cloudflare's documentation draws a line that is easy to get backwards. A Cloudflare-branded 502 or 504 page means your origin server returned that status itself.
A blank 502 or 504 with no Cloudflare branding means Cloudflare generated the error.
Cloudflare names two causes for the blank version: gzip content served with a wrong content-length header, and a traffic reroute between data centers that usually settles within seconds.
Test the first by turning compression off at the origin, and test the second with one reload after a minute.
Cloudflare also writes its own 52x codes, and the title of each documentation page states the meaning:
- 520: web server returns an unknown error
- 521: web server is down
- 522: connection timed out
- 523: origin is unreachable
- 524: a timeout occurred
- 525: SSL handshake failed
- 526: invalid SSL certificate
Error 524 means Cloudflare connected to your origin, but the origin sent no HTTP response within the default 125 second proxy read timeout.
Enterprise plans can raise that limit up to 6,000 seconds. A separate 30 second proxy write timeout cannot be adjusted.
A long export belongs on a DNS-only, grey-clouded subdomain that skips the proxy, which is Cloudflare's own suggestion.
A plain 503 Service Unavailable is a different message, because MDN describes it as the server not being ready to handle the request, usually during maintenance or overload.
The ExplainWP guide to 502 and 504 gateway errors in WordPress adds the PHP and Nginx time limits, the plugin test and the Cloudflare pause test.
Four wp-config.php Values Behind a Database Connection Error
WordPress writes "Error establishing a database connection" when it cannot reach the database, and its documentation says a wrong value in wp-config.php is the usual cause.
Compare four values in wp-config.php with the database details in your host's control panel:
| Constant | What it holds |
|---|---|
| DB_NAME | The database name |
| DB_USER | The database username |
| DB_PASSWORD | The database password |
| DB_HOST | The database host |
Your host's database screen shows the correct host value, which is not always localhost.
If the four values match, the same documentation page lists two host-side causes: a database that hit its quota and was shut down, and a server that is down.
Only your host can confirm either, so ask before you reset anything.
A hacked site is the third documented possibility, and it belongs last, after the credentials and the host.
A damaged table is a separate fault from a failed connection, and the wp-config.php documentation covers it with one constant:
define( 'WP_ALLOW_REPAIR', true );
Add the line above the stop editing comment, then open yoursite.com/wp-admin/maint/repair.php and run the repair.
Remove it immediately: The repair page needs no login, because a corrupted database often blocks logins. Anyone who knows the URL can run it while the constant is on, so delete the line the moment the repair finishes.
The ExplainWP walkthrough of Error Establishing a Database Connection adds the phpMyAdmin and new database steps.
Raise Memory and Time Limits Last, Not First
Raising a memory or time limit removes the symptom and leaves the cause, so do it after the isolation tests have named the culprit.
The log line "Allowed memory size of XXXXX bytes exhausted" means PHP ran out of memory for one request.
WordPress attempts to raise PHP's memory to 40 MB on a single site and 64 MB on multisite, according to the wp-config.php documentation.
Add this line above the "That's all, stop editing!" comment in wp-config.php:
define( 'WP_MEMORY_LIMIT', '128M' );
Reload the failing page. The memory line should stop appearing in debug.log.
Admin screens have their own WP_MAX_MEMORY_LIMIT setting for heavier tasks.
Some hosts cap PHP below the value you set, and the documentation tells you to contact the host in that case.
A larger limit can also hide a plugin that leaks memory, so run Test 1 again if the error returns.
The ExplainWP guide to the WordPress memory limit covers host caps and the Site Health check.
The message "Maximum execution time of 30 seconds exceeded" means a script hit PHP's time limit.
WordPress's common errors page fixes it with a line in php.ini, or with a request to your host on shared plans:
max_execution_time = 60
Keep PHP's limit below what the proxy in front of it will wait for: a job allowed 300 seconds in PHP still ends in a 524 when Cloudflare stops waiting at its default 125 seconds.
PHP Version Changes Are a Layer of Their Own
WordPress.org recommends PHP 8.3 or greater, MariaDB 10.11 or greater or MySQL 8.0 or greater, and HTTPS support.
In legacy environments WordPress still runs on PHP 7.4 or later and MySQL 5.5.5 or later, but both are past end of life and may expose your site to security vulnerabilities.
WordPress's common errors documentation lists an incompatible PHP version among the usual causes of a critical error.
Roll the PHP version back in your host's control panel to confirm, then update the plugin or theme that needs a different release.
The ExplainWP guide to checking and updating the PHP version shows how to see which PHP your site runs.
Two Messages Only WordPress Itself Can Write
Two messages come from WordPress code instead of the server or PHP: the editor notice "Updating failed. The response is not a valid JSON response." and the maintenance screen.
The block editor writes the first notice when its request to the REST API returns something other than valid JSON.
The ExplainWP fix for the valid JSON response error orders the causes from most to least likely.
Start with Settings → Permalinks and Save Changes without editing anything, then test plugins that block the REST API.
A quick test: open yoursite.com/wp-json/wp/v2/posts in a browser. JSON means the REST API answers, and an error page or a blank screen means something blocks it.
WordPress creates a .maintenance file during an update, and a leftover copy keeps the message "Briefly unavailable for scheduled maintenance. Please check back in a minute." on screen.
Delete .maintenance from the site root over FTP and reload the page.
What to Send Your Host When the Tests Find Nothing
Cloudflare's documentation warns that the cause of a 5xx error is not always in the origin server's logs, so ask your host to check every layer between the visitor and PHP, including load balancers, caches, proxies and firewalls.
Send these four details in one message:
- The exact message or status code, such as "502 Bad Gateway" or "Error establishing a database connection".
- The time of the failure and your timezone.
- The URL that failed.
- The last "PHP Fatal error" line from
debug.log, or a line saying the log stayed empty.
Add which of the three tests you ran and what changed, so the first reply can be a diagnosis.
An empty debug.log after all three tests means the failure happened before WordPress loaded, and the server's own PHP error log is the place to look.
Ask your host to read the lines around the time you noted and send them back.
Questions About WordPress Error Messages
What does "There has been a critical error on this website" mean in WordPress?
PHP stopped on a fatal error inside a plugin, a theme or a WordPress file, and the fatal error handler added in WordPress 5.2 caught it. The recovery link emailed to the admin address pauses the faulty extension for one browser only, so visitors keep seeing the error.
Why does my WordPress site show a blank white page?
PHP hit a fatal error and the site is not set to display it, which is normal on a live site. Turn on WP_DEBUG and WP_DEBUG_LOG in wp-config.php, reload once, and the file path in the last PHP Fatal error line of wp-content/debug.log names the plugin or theme at fault.
What is the difference between a 502 and a 504 error in WordPress?
A 502 means a gateway or proxy received an invalid response from the server behind it, and a 504 means it received no response in time. The gateway is usually Nginx, Apache or Cloudflare, so the fault sits in PHP, a plugin or the origin server.
Is it safe to leave WP_DEBUG turned on?
No, because WordPress's documentation says WP_DEBUG and the other debug tools are meant for local testing and staging installs, not live sites. Switch the constants off and delete wp-content/debug.log when the test is finished, since an error log in a publicly accessible location is a security risk.
How much memory does WordPress use by default?
WordPress tries to raise PHP's memory limit to 40 MB on a single site and 64 MB on multisite, according to the wp-config.php documentation. Set WP_MEMORY_LIMIT in wp-config.php to ask for more, but a host cap overrides it and a higher limit can hide a plugin that leaks memory.
