Guides
How to Read WordPress Debug Logs and Find the Real Problem
If your WordPress site is acting up, the debug log can usually tell you what broke, where it broke, and which plugin, theme, or core file is involved. The trick is not just opening the log, but reading it in the right order so you can separate the real error from harmless notices and warnings.
Start with the first fatal error, the file path, and the line number. Those three details usually point to the actual cause, while the rest of the log often contains follow-up noise from the same failure.
What you’re probably seeing
You may have a blank page, a critical error message, a specific feature that stopped working, or an admin area that loads but behaves strangely. In many cases, the site still looks “mostly fine,” which makes the problem harder to spot from the front end.
The debug log helps when:
- a plugin update introduced an error
- a theme template is calling a missing function or file
- a PHP version change exposed old code
- a form, checkout, search, or REST endpoint fails without a visible message
- your site is slow because a plugin is throwing repeated warnings on every request
Important: the debug log is not always the best place to start for a full white screen or database error. If your site is showing a broader failure, one of these guides may be a better first step: How to Fix the WordPress White Screen of Death, There Has Been a Critical Error on This Website: What It Means and How to Fix It, or How to Fix the WordPress "Error Establishing a Database Connection" Error.
What the WordPress debug log actually is
WordPress can write PHP errors, warnings, notices, and some stack traces to a log file when debugging is enabled. That log is usually found at wp-content/debug.log, though some hosts route logs elsewhere or store them outside the web root.
The log is useful because it captures what WordPress was doing at the moment the problem happened. But it is easy to misread. Not every line means the site is broken, and not every error is caused by the line you notice first.
How to turn logging on safely
Before changing anything, back up your site. If you can, work on a staging copy first. Logging is low-risk, but the troubleshooting that follows often is not.
- Open
wp-config.php. - Find the line that says
/* That's all, stop editing! Happy publishing. */. - Add or update these lines above it:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
This setup writes errors to a log file without showing them to visitors. That matters because displaying errors publicly can leak file paths, plugin names, and other useful clues to attackers.
If you already have a log, note the time the issue started. Then reproduce the problem once, so the relevant entries are close together.
How to read the log without getting lost
When you open the log, ignore the urge to read every line from top to bottom. Start with the newest entries around the time the problem occurred, then work backward only if needed.
Look for these patterns first
- Fatal error: usually the most important line. Something stopped execution.
- Uncaught Error: often means a function, class, or method was called incorrectly.
- Parse error: usually syntax trouble in code, often after a bad edit or update.
- Allowed memory size exhausted: a plugin, theme, import, or query is using too much memory.
- Call to undefined function/class: code expects something that is missing, disabled, or outdated.
Then read the line that matters most
A useful log entry often includes a file path and a line number, like this:
PHP Fatal error: Uncaught Error: Call to undefined function get_field() in /home/example/public_html/wp-content/themes/mytheme/functions.php:148
That tells you several things at once:
- the error is fatal, not cosmetic
- the problem is in the theme, not necessarily WordPress core
- the function
get_field()is missing - the failing line is
functions.phpline 148
In that example, the likely cause is a missing or inactive plugin that provides get_field(), often something like a custom fields plugin. The log does not prove the root cause by itself, but it points you to the right component fast.
Learn the difference between noise and signal
WordPress logs often contain notices and warnings that are not the immediate cause of the visible issue. For example, a plugin might log a deprecation notice every page load, but the site still works.
Focus on entries that match the symptom:
- If the whole site is down, look for fatal errors near the time of failure.
- If one page or feature is broken, look for entries that mention the relevant plugin, theme, template, or endpoint.
- If the site is slow, look for repeated warnings or errors from the same component across multiple requests.
The fastest way to identify the real culprit
Once you have a candidate error, use this sequence:
- Check the file path — does it point to a plugin, theme, or core file?
- Check the line number — is it inside your custom code, a third-party plugin, or a child theme?
- Check what changed recently — update, migration, new plugin, PHP version change, or custom code edit.
- Disable the suspected component safely — on staging if possible, or by renaming the plugin folder through SFTP/File Manager if admin access is broken.
- Retest the exact action that caused the error.
If the error disappears when a plugin is disabled, that does not automatically mean the plugin is “bad.” It may be incompatible with your PHP version, conflicting with another plugin, or missing a dependency.
Common log entries and what they usually mean
| Log entry | What it usually means | What to check next |
|---|---|---|
| Fatal error | The request stopped completely | File path, line number, related plugin or theme |
| Call to undefined function | Missing plugin, missing include, or incompatible code | Whether a required plugin is active |
| Allowed memory size exhausted | WordPress ran out of PHP memory | Heavy plugin, large import, image processing, memory limit |
| Parse error | Syntax problem in code | Recent custom edits or broken update files |
| Deprecated / Notice / Warning | Code quality issue, compatibility clue, or non-fatal problem | Whether the same notice repeats with a real failure |
What to do after you find the line
Once the log points you to a plugin, theme, or custom snippet, resist the temptation to edit random files until the site works. A safer approach is to isolate the source first.
Use this order:
- Update only if there is a known compatibility fix and you have a backup.
- Disable the suspected plugin or theme component if you can do so safely.
- Roll back recent custom code changes if the error started after an edit.
- Replace a broken plugin or theme file with a clean copy from a trusted source.
If the issue started after an update and you need a deeper workflow for that situation, see What to Do When a WordPress Update Breaks the Site.
If the log suggests an update or compatibility issue more generally, WordPress Site Broke After an Update? Here's What Happened and How to Fix It is a useful next stop.
How to avoid chasing the wrong error
One of the biggest mistakes is treating the latest log entry as the cause. Often it is just the first place WordPress noticed the failure after an earlier problem.
To avoid that trap:
- match the error time to the action you took
- compare repeated entries instead of a single line
- look for the same plugin or file appearing across multiple requests
- check whether the error began after a version change, not just after a plugin update
Another common mistake is leaving debugging enabled after the fix. Turn off logging when you are done, especially on a production site:
define( 'WP_DEBUG', false );
You can also leave WP_DEBUG_LOG in place for future troubleshooting if your workflow or host supports it, but don’t leave errors visible to visitors.
When the debug log is enough, and when it is not
The log is usually enough when the issue comes from a single plugin, theme, or custom snippet and the error is explicit. It is less enough when multiple things are broken at once, the site was recently hacked, the server is throwing mixed errors, or the log itself is incomplete because of hosting limits.
Call a professional if you see repeated fatals, security-related code changes, database corruption, or a log that points to more than one possible cause. If you need the site fixed fast and want the root cause explained in plain English, Mend’s senior engineers can investigate on a backup-first workflow and send back exactly what changed. You can start with a free diagnosis at /start/diagnosis, or go straight to /start/emergency if the site is down right now.
If you’d rather avoid the back-and-forth of digging through logs yourself, connect your site securely without sharing passwords and let Mend handle the debugging for you. Every paid fix includes a plain-English report and a fixed-or-your-money-back guarantee.
A simple debug-log workflow you can reuse
- Back up the site.
- Enable logging without displaying errors.
- Reproduce the problem once.
- Find the first fatal error near that time.
- Read the file path and line number.
- Check recent changes, then isolate the suspected plugin, theme, or custom code.
- Retest and confirm the fix.
- Turn debugging off again.
That process is simple, but it works because it follows evidence instead of guesswork. The debug log is most valuable when you use it to narrow the problem to one file, one function, or one recent change.
If you want a related read after this, Diagnose a WordPress 500 Error Without Guessing pairs well with log-based debugging, and WordPress Caching Explained: What to Clear and When helps when a fix does not seem to show up immediately.
Frequently asked questions
Where is the WordPress debug log stored?
It is commonly found at wp-content/debug.log, but some hosts store logs elsewhere. If you do not see it there, check your hosting control panel or ask the host where PHP error logs are written.
Should I leave WP_DEBUG on all the time?
No for production sites, especially if errors could display publicly. Turn it on only while troubleshooting, and disable it again after you are done.
What is the difference between a warning and a fatal error?
A warning may not stop the page from loading, while a fatal error usually breaks the request completely. When you are chasing a site outage, focus on fatal errors first.
The log shows a plugin name, so is that definitely the cause?
Usually it is the best lead, but not always the full story. The plugin may be incompatible with your PHP version, missing a dependency, or conflicting with another plugin or theme.