Skip to content
Paul Bunyan Message Logger. The best damn logger there ever was. WordPress, PHP, MySQL.

How to enable WordPress debug mode, and what to do next

Turn on WordPress debug mode with three lines in wp-config.php, find debug.log, and learn what to do with what it shows you.

Updated · By Diamond Sierra

On this page

To turn on WordPress debug mode, add three lines to wp-config.php above the line that says "That's all, stop editing". WordPress will then write PHP errors to wp-content/debug.log without showing them to visitors.

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

What does each debug setting do?

SettingWhat it does
WP_DEBUGTurns on error reporting for PHP errors, warnings, notices and deprecations.
WP_DEBUG_LOGSaves them to wp-content/debug.log. Give it a file path in place of true to save somewhere else.
WP_DEBUG_DISPLAYShows errors on the page when true. Keep it false on a live site.
SCRIPT_DEBUGLoads the full, unminified versions of WordPress's own scripts and styles.
SAVEQUERIESRecords every database query for the current page. It slows the site, so turn it off afterwards.

Where is the WordPress debug log?

By default it is wp-content/debug.log. The file does not exist until the first error is written. If it never appears, either nothing has gone wrong yet or the web server cannot write to the wp-content folder.

Is it safe to turn on debug mode on a live site?

Yes, with two conditions. Keep WP_DEBUG_DISPLAY set to false, so visitors never see error text. And protect the log file, because by default anyone who types its address can open it. See Is debug.log public?

What do I do after debug mode is on?

This is where most guides stop. The log is only useful once you can read it.

  1. Reproduce the problem: load the page that breaks or runs slowly.
  2. Open debug.log and go to the last lines.
  3. Find the file path in the error. The folder name after plugins/ or themes/ tells you whose code it is.
  4. Act on it: update, replace or report that plugin. See How to read the WordPress debug log.

What debug mode will not tell you

Debug mode records PHP errors. It does not record slow pages, slow database queries, slow calls to outside services, slow emails or scheduled jobs that overran. A site can be painfully slow with an empty debug log.

How Paul Bunyan helps

Paul Bunyan records errors and timings together. Errors are grouped and counted by plugin, and every request is timed, so the same screen shows you what broke and what was slow. No wp-config.php edit is needed.