Skip to content

Tutorials WordPress Beginner1 min read

How to Enable WordPress Debug Mode

Turn on WP_DEBUG and WP_DEBUG_LOG safely to find PHP errors in WordPress, read debug.log, and switch debugging off again when you're done.

By ZSOLNET Editorial Team Updated

Key takeaways

  • WP_DEBUG reveals PHP errors that WordPress normally hides.
  • Log errors to a file instead of showing them to visitors.
  • Turn debugging off when finished — debug.log can be publicly readable.

Turn on logging

  1. Open wp-config.php with cPanel’s File Manager or SFTP.
  2. Find define( 'WP_DEBUG', false ); and replace it with:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );      // write errors to wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false ); // don't show them on the page
@ini_set( 'display_errors', 0 );
  1. Save the file and reproduce the problem.

Read the log

Open wp-content/debug.log. Each line has a timestamp, a level and a file path:

  • PHP Fatal error — stops the page; this is what causes critical errors and blank screens.
  • PHP Warning — something went wrong but the page continued.
  • PHP Notice / Deprecated — code that should be updated; usually harmless.

The folder after wp-content/plugins/ or wp-content/themes/ tells you which plugin or theme is responsible.

Turn it off again

Set WP_DEBUG back to false and delete debug.log. If you need to keep logging longer, move the log outside the public folder:

define( 'WP_DEBUG_LOG', '/home/username/logs/wp-debug.log' );

Frequently asked questions

Where is debug.log?

By default it's wp-content/debug.log. You can choose another path by giving WP_DEBUG_LOG a file path instead of true.

Is it safe to leave debug mode on?

No. Error output can reveal file paths and other details attackers find useful. Use it while investigating, then switch it off.

Share X LinkedIn Facebook

Log in to your account

Manage your domains, hosting and invoices in one place.

Secure connection straight to the ZSOLNET client area.

No account yet?