ZeroToWP

Error Log

Quick Definition

The WordPress error log (debug.log) is a file that records every PHP error, warning, and notice that occurs on your site. It is your primary tool for diagnosing problems when something breaks.

WPBeginner guide on finding and accessing WordPress error logs

What Is the Error Log?

The error log in WordPress is a plain text file — typically located at wp-content/debug.log — that records every PHP error, warning, and notice that happens on your site. When a plugin crashes, a theme function breaks, or a database query fails, the details go into this file with a timestamp, the exact error message, and the file and line number where it occurred.

The error log is created when you enable WordPress debug mode by adding three lines to wp-config.php:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

This configuration logs all errors to the file without showing them to visitors — the safest approach for staging and production troubleshooting.

There are four main types of PHP errors you will find in the log:

  • Fatal Error — The site crashes. Something called a function that does not exist or ran out of memory. This causes the White Screen of Death.
  • Parse Error — A syntax mistake in PHP code (missing semicolon, unclosed bracket). The file cannot be processed at all.
  • Warning — Something went wrong but the site continues to work. Often a deprecated function or a missing file.
  • Notice — A minor issue, like using an undefined variable. Does not affect functionality but indicates sloppy code.

A typical error log entry looks like:

[20-Mar-2026 14:23:45 UTC] PHP Fatal error: Uncaught Error: Call to undefined function my_broken_function() in /wp-content/plugins/broken-plugin/index.php on line 42

This tells you exactly: when (timestamp), what (fatal error, undefined function), and where (file path and line number).

Error Logs in Practice

To access your error log:

  • Via FTP/SFTP — Navigate to wp-content/debug.log and download it
  • Via hosting file manager — Most hosts (cPanel, SiteGround, Kinsta) let you browse files in the dashboard
  • Via hosting error logs — Many hosts provide a separate error log viewer at a server level (separate from WordPress's debug.log)
  • Via plugins — Plugins like WP Debugging and Error Log Monitor let you view the log from the WordPress admin

When troubleshooting, always check the most recent entries at the bottom of the file. Sort by timestamp and look for Fatal or Parse errors first — they are the ones causing visible problems. Warnings and notices are important for developers but rarely affect what visitors see.

Important: delete or clear your debug.log regularly. On a busy site with many notices, it can grow to hundreds of megabytes and waste disk space. And never leave WP_DEBUG enabled on production — error messages can reveal file paths and server details that help attackers.

Why It Matters

The error log is the single most useful troubleshooting tool in WordPress. When your site breaks, stops loading, or behaves unexpectedly, the log tells you exactly what went wrong. Without it, you are guessing. With it, you have the file, line number, and error message — everything you need to fix the problem or report it to the plugin developer.

Sources

Related Terms

Related Articles