Turn on WordPress debug logging

debug, wp_debug, wp-config, log, troubleshooting · 0 found this helpful

Debug logging records PHP warnings and errors from WordPress. It helps when a site misbehaves and there's no useful message. Always log to a file. Never show errors to visitors.

Method 1: In your account

  1. Open Account → Hosting → your site → WordPress and click Manage next to your site.
  2. Open Speed and debug and switch on Debugging.
Speed and debug, with switches for maintenance mode and debugging
  1. Reproduce the problem.
  2. Turn it off.

Method 2: wp-config.php

Edit wp-config.php in Files. Replace the existing WP_DEBUG line with:

// Debugging: log errors, hide them from visitors
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Reload the broken page. The log is wp-content/debug.log.

Method 3: WP-CLI

wp config set WP_DEBUG true --raw
wp config set WP_DEBUG_LOG true --raw
wp config set WP_DEBUG_DISPLAY false --raw

See Use WP-CLI.

Read the log

tail -n 50 ~/public_html/wp-content/debug.log

Or open it in Files. Read the last lines first. A path such as wp-content/plugins/shop-sync/ names the plugin responsible.

Turn it off

When you're done, set WP_DEBUG back to false:

wp config set WP_DEBUG false --raw
rm ~/public_html/wp-content/debug.log

Important: debug.log is readable from the web at https://example.ca/wp-content/debug.log unless you block it. Delete it after use, or add a rule in .htaccess:

# Block public access to debug.log
<Files debug.log>
  Require all denied
</Files>

If something goes wrong

  • No log appears: the problem isn't PHP, or the folder isn't writable. Check Read your site's error log.
  • Huge log: a repeating notice. Fix or silence it.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.