All guides
Troubleshooting guide Debugging

WordPress Error Logs: How to Read debug.log Like an Engineer

A plain-English field guide to the WordPress debug.log file. What every fatal error, warning, and notice actually means, and what to do next.

Arjun Mehta Published June 20, 2026 Last reviewed June 20, 2026 9 min read Step-by-step walkthrough
Reviewed and tested by the WPRescue team on a real WordPress install before publishing. How we test fixes
WordPress debug.log entries shown in a log viewer

What's Happening

WordPress writes errors to /wp-content/debug.log when WP_DEBUG_LOG is enabled, but the entries look like nonsense if you have never read a PHP stack trace. This guide turns each common line into a clear cause and fix.

Every WordPress engineer I know has the same first move when a site breaks: open debug.log. It is the closest thing WordPress has to a black-box recorder. The trouble is that the file reads like a foreign language until someone walks you through it.

I have spent twelve years staring at this file at odd hours, and most entries fall into a small set of patterns. Once you can recognize them, you stop guessing and start fixing. This guide is the dictionary I wish I had on my first job.

We will turn on logging the right way, then translate each common line you will see, from fatal errors that take the site down to deprecation notices you can usually ignore. By the end you will be able to read any debug.log entry and know exactly what to do next.

Turn On the WordPress Error Log Safely

WordPress does not log errors by default. You have to opt in by editing wp-config.php. The safe pattern, and the one I use on every client site, is to log to a file without showing errors to visitors. That way you get full debugging power without leaking file paths to the public.

Open wp-config.php through FTP or your host's file manager and place the snippet below right above the line that reads /* That's all, stop editing! Happy publishing. */. Order matters, these constants must load before WordPress bootstraps the rest of the request.

phpProduction-safe debug logging. Errors go to /wp-content/debug.log, visitors see nothing.
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

Where to Find debug.log and How to Open It

Once logging is on and the error fires again, WordPress writes to /wp-content/debug.log. Open it with any plain text editor, scroll to the bottom, and read upward. The newest entries sit at the end of the file, and the most recent fatal is almost always the one taking the site down.

Each line follows a predictable shape: a timestamp in UTC, an error level, a human message, and a file path with a line number. Once you train your eye on that shape, scanning the log becomes second nature.

textAnatomy of a debug.log line: timestamp, level, message, file path, line number.
[20-Jun-2026 09:14:02 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function wc_get_product() in /home/site/public_html/wp-content/plugins/my-addon/loader.php:42

Dictionary: The Errors You Will Actually See

Below are the entries that account for the vast majority of real-world debug.log output. For each one I have included the literal message you will see, what it means in plain English, and the fix I run first.

  • PHP Fatal error: Allowed memory size of N bytes exhausted — PHP ran out of memory mid-request. Raise WP_MEMORY_LIMIT to 256M or 512M, then look at the file path on the same line to find which plugin is the heavy spender.
  • PHP Fatal error: Maximum execution time of N seconds exceeded — a request took too long, usually a cron job, an import, or a slow external API call. Increase max_execution_time on the host, or move the work to WP-CLI or Action Scheduler.
  • PHP Fatal error: Uncaught Error: Call to undefined function X() — the calling code expected a function that does not exist in this PHP version or in the currently active plugins. Either restore the missing plugin or update the caller to a supported API.
  • PHP Fatal error: Cannot redeclare function X() — two pieces of code defined the same function name. Rename the function you control, or deactivate one of the two conflicting plugins.
  • PHP Parse error: syntax error, unexpected token — a file has a typo, usually in functions.php or wp-config.php after a manual edit. Revert the edit or fix the syntax, the site will stay down until you do.
  • PHP Warning: include(...): failed to open stream — a plugin tried to load a file that is missing. Reinstall the plugin from a fresh ZIP, do not just delete the line.
  • PHP Warning: Cannot modify header information - headers already sent — something printed output before WordPress sent its HTTP headers, often a stray space at the top of wp-config.php or an echo in a theme file. Remove the early output.
  • PHP Notice: Undefined index / Undefined variable — a plugin read an array key or variable that was never set. Usually harmless but noisy, and a sign the plugin has not been updated for current PHP.
  • PHP Deprecated: Function X is deprecated — your PHP version flagged a function the plugin should stop using. Update the plugin or report the issue upstream, then mute the noise so it does not hide real errors.
  • WordPress database error … for query — MySQL rejected a query. The exact error text tells you whether it is a missing table, a syntax issue, or a permissions problem.

Trace a Real Error From debug.log to Fix

Reading is half the skill. The other half is acting on what you read. Here is the routine I run on every client log, in order, so I never waste time chasing the wrong lead.

Step one, find the newest fatal. Anything above it is older noise. Step two, copy the file path and line number into your editor or FTP client and open that exact line. Step three, identify the component, almost every path includes /wp-content/plugins/<name>/ or /wp-content/themes/<name>/, which tells you who to fix or remove.

Step four, decide between three options: update the component, swap it for an alternative, or remove it. I do not try to patch third-party plugin code on a live site unless I own the codebase. A clean swap is faster and safer than a hotfix.

Keep the Log Useful Over Time

A debug.log that grows for months becomes useless. Every real error gets buried under thousands of repeated notices. After you ship a fix, delete the log, reproduce normal traffic, and confirm the file stays small. If it grows again, you have another bug to chase.

On sites that handle sensitive data, move the log outside /wp-content with an absolute path so it cannot be downloaded by a curious visitor. And turn debug mode off entirely once you are done. Logging is a tool for fixing, not a default state for a healthy site.

phpSend debug.log to a path outside the web root so it cannot be served publicly.
define('WP_DEBUG_LOG', '/var/log/wp/site-debug.log');

Complete Fix Checklist

  1. 1Open wp-config.php and set define('WP_DEBUG', true);, define('WP_DEBUG_LOG', true);, define('WP_DEBUG_DISPLAY', false);.
  2. 2Reproduce the error on the site so a fresh entry lands in /wp-content/debug.log.
  3. 3Open debug.log via FTP or your host's file manager and scroll to the most recent timestamp.
  4. 4Match the error prefix (PHP Fatal error, PHP Warning, PHP Notice, PHP Deprecated) to the dictionary in this guide.
  5. 5Read the file path at the end of the line to identify which plugin or theme triggered it, then fix or replace that component.

Quick Tips

  • Keep WP_DEBUG_DISPLAY false on production so visitors never see raw errors
  • Rotate or delete debug.log after a fix so the next failure is easy to spot
  • Store debug.log outside the web root for sensitive sites

Frequently Asked Questions

Why is my debug.log file empty even though my site is broken?
Either WP_DEBUG_LOG is not actually true in wp-config.php, the error happens before WordPress loads (a syntax error in wp-config itself or a server-level 500), or /wp-content is not writable. Check the file permissions on /wp-content first, then look at your host's PHP error log for pre-WordPress failures.
What does 'Allowed memory size of X bytes exhausted' mean?
PHP hit the memory_limit set for the request and stopped. Raise WP_MEMORY_LIMIT in wp-config.php to 256M or 512M, then track down the plugin or query at the file path on the same line so you fix the cause, not just the symptom.
What does 'Call to undefined function' mean?
A plugin or theme called a function that does not exist in this PHP version, or that lives in a plugin which is deactivated or deleted. Reactivate the missing plugin, update the calling component, or remove the orphaned code.
What does 'Cannot redeclare function' mean?
Two plugins, or a plugin and a theme, defined a function with the same name. Rename the function in the component you control, or replace one of the two conflicting components.
Why does debug.log fill up with the same warning thousands of times?
A loop or a cron job is hitting the same broken code on every request. Fix the underlying warning, do not just suppress it. A growing log can also fill the disk on small hosting plans.
Is it safe to delete debug.log?
Yes. WordPress recreates the file on the next error when WP_DEBUG_LOG is enabled. Deleting it between fixes makes it easy to see whether the latest change actually stopped the error.
Can I read the log without FTP?
Yes. Most hosts offer a file manager in cPanel or Plesk. Some security plugins, such as WP Debugging or Query Monitor, also surface debug.log entries inside wp-admin so you do not have to leave the dashboard.

Related Guides