How to debug errors in WordPress
Turn on WP_DEBUG and the debug log safely, read the error, isolate a plugin or theme, and switch debugging off again so nothing leaks.
At a glance
A white screen, a critical error message or a feature that silently does nothing share one first step: make WordPress tell you what went wrong. Turn on WP_DEBUG with logging and display off, read wp-content/debug.log, isolate the plugin or theme by deactivating one thing at a time, then switch debugging off and delete the log so nothing leaks.
Updated November 29, 2026 · For WordPress site owners and developers
- For owners and developers facing a white screen, critical error or silent failure
- Settings WP_DEBUG true, WP_DEBUG_LOG true, WP_DEBUG_DISPLAY false
- Log location wp-content/debug.log, or a path outside the web root
- Isolate deactivate all plugins, then one at a time; try a default theme
- Safety back up or use staging; switch debugging off and delete the log afterwards
- Recovery mode WordPress 5.2 and later may email an administrator a recovery link
- Help emergency support or WordPress support
On this page
A white screen, a "critical error" message or a feature that silently does nothing all have the same first step: make WordPress tell you what went wrong, then change one thing at a time.
How do I turn on the debug log?
Edit wp-config.php over SFTP or your host's file manager. Add these lines above the comment that says to stop editing:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );WP_DEBUG_LOG writes errors to wp-content/debug.log. WP_DEBUG_DISPLAY set to false keeps them off the page, so visitors never see a stack trace. If the constants are already defined, change the existing lines rather than adding duplicates.
Reproduce the problem, then open the log. The last lines are usually the cause. A fatal error names a file under wp-content/plugins/ or wp-content/themes/, which tells you who is responsible.
How do I read the error?
| What the log says | What it usually means |
|---|---|
| Fatal error, with a path | The plugin or theme in that path is the culprit or is missing a dependency |
| Allowed memory size exhausted | A script ran out of PHP memory; find what was running before raising the limit |
| Call to undefined function | A plugin needing another plugin, or a PHP version mismatch after an update |
| Database errors | Check credentials in wp-config.php and that the database server is up |
Since WordPress 5.2 a fatal error can also trigger recovery mode, which emails the administrator a special link to log in and deactivate the broken plugin or theme. Check that inbox first.
| Level | Meaning |
|---|---|
| Fatal error | Execution stopped; the page is broken |
| Warning | Something went wrong but the page continued |
| Notice or deprecated | Works today but uses something being retired; rarely the cause of a broken page |
When a site fails, read from the bottom of the file for the newest fatal error first.
How do I isolate the cause?
- Take a backup,
or work on a staging copy.
- Deactivate all plugins
If you cannot reach the dashboard, rename
wp-content/pluginstoplugins-off, or runwp plugin deactivate --allwith WP-CLI. - Reactivate one at a time
until the problem returns, if it was gone.
- Switch to a default theme
such as the newest Twenty-series theme, if it persists.
- Look at the host
the PHP error log in the hosting panel, the PHP version and recent changes such as an update or a migration.
What if the problem is in the browser?
If the page loads but a button, slider or form is dead, the error is in JavaScript. Open developer tools, the Console tab, and reload. For slow or failing requests, check the Network tab. The Query Monitor plugin is useful on staging for slow queries and hooks.
How do I keep the log private?
On many setups wp-content/debug.log can be fetched by anyone who guesses the address, and it can contain file paths, plugin names and sometimes user data.
- Keep the debugging window short: switch on, reproduce once, read, switch off.
- Delete the file afterwards.
- If your host allows, send the log outside the web root with a path, for example
define( 'WP_DEBUG_LOG', '/home/youraccount/logs/wp-debug.log' );. The folder must exist and be writable by the web server, and the path is specific to your host.
When you are done set WP_DEBUG back to false or remove the lines, and delete `wp-content/debug.log`.
What other switches are useful?
| Constant | Use | Caution |
|---|---|---|
SCRIPT_DEBUG true | Loads unminified core scripts and styles for readable console errors | Turn off afterwards |
WP_DEBUG_DISPLAY false plus @ini_set( 'display_errors', 0 ); | Stops anything printing even when a plugin changes settings | None |
SAVEQUERIES true | Records queries for Query Monitor | Slows the site; staging only |
A worked example
A contact page shows a blank area where the form should be. You switch the log on, reload and find a line saying a function from the form plugin is undefined and the call came from a file in your theme. A plugin update probably removed or renamed the function. The fix is to update the theme code, or roll the plugin back until the theme is fixed. Without the log you might have spent an hour reinstalling the form plugin and learned nothing.
What mistakes are common?
Still stuck?
If the site is down or a store cannot take orders, call for emergency support. For anything else, ask an engineer, and we will find the cause with you.
Send the last lines of your log.
Where is the WordPress debug log?
With WP_DEBUG_LOG set to true, WordPress writes to wp-content/debug.log. Delete it when you finish, because it can be read by anyone who guesses the URL on many setups.
Link to this answerIs it safe to leave WP_DEBUG on?
No. Turn it off when you are done. At minimum never display errors to visitors on a live site.
Link to this answerWhat is the difference between WP_DEBUG_LOG and the host's PHP error log?
WP_DEBUG_LOG writes WordPress-level notices and errors to wp-content/debug.log. The host's PHP error log is kept outside WordPress and also catches errors that stop WordPress loading at all, so check both.
Link to this answerShould I debug on the live site?
Prefer a staging copy. If you must debug live, keep display off, log only, reproduce the fault once, then switch it all off and delete the log.
Link to this answerWhy do my debug settings not work?
The define lines must go above the comment that says to stop editing in wp-config.php. If a constant is already defined, change the existing line instead of adding a duplicate.
Link to this answerWhat does a fatal error line tell me?
It names a file under wp-content/plugins or wp-content/themes, which tells you which plugin or theme is the culprit or is missing a dependency.
Link to this answerWhat does Allowed memory size exhausted mean?
A script ran out of PHP memory. Find what was running before simply raising the limit, since a bigger limit can hide the real cause.
Link to this answerHow do I deactivate plugins if I cannot reach the dashboard?
Rename the wp-content/plugins folder to plugins-off, and WordPress treats them all as deactivated. With WP-CLI, run wp plugin deactivate --all.
Link to this answerWhat is recovery mode?
Since WordPress 5.2 a fatal error can trigger recovery mode, which emails the site administrator a special link to log in and deactivate the broken plugin or theme. Check that inbox first.
Link to this answerHow do I keep the debug log from being public?
Keep the debugging window short, delete the file afterwards and, if your host allows, give WP_DEBUG_LOG a file path outside the web root. The folder must exist and be writable by the web server.
Link to this answerWhat is the difference between a fatal error, a warning and a notice?
A fatal error stops execution and breaks the page, a warning means something went wrong but the page continued, and a notice or deprecated message flags code that works today but is being retired. Read from the bottom of the file for the newest fatal error first.
Link to this answerKeep reading
Want an engineer on it?
Tell us what is wrong in plain words. A person reads it, today.