Saturday, October 24, 2026The WordPress PlaygroundFacebookXPinterest
Glossary

Debug Mode (WP_DEBUG)

Debug mode is a built-in WordPress feature that reveals the PHP errors, warnings and notices happening behind the scenes. You turn it on with a single constant called WP_DEBUG in your wp-config.php file.

When your site breaks and shows no useful message, debug mode tells you exactly which file and line caused the trouble.

How does WP_DEBUG work?

By default, WP_DEBUG is set to false, and WordPress keeps most warnings and notices quiet. When you set it to true, WordPress starts reporting every problem it finds. Think of it as switching on the lights in a dark room, so you can see what you tripped over.

Two helper constants make debug mode safer to use:

  • WP_DEBUG_LOG saves errors to a file named debug.log inside the wp-content folder.
  • WP_DEBUG_DISPLAY controls whether errors are printed on the screen.

How to enable debug mode in WordPress

  1. First, open wp-config.php in your site's root folder using FTP or your host's file manager.
  2. Next, find the line that defines WP_DEBUG and replace it with the code below. If there is no such line, add the code just above the comment that tells you to stop editing.
  3. Now, save the file and reload the page that shows the problem.
  4. Finally, open wp-content/debug.log to read the errors.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

This setup records every error in the log file without showing it to your visitors. Our guide on how to debug in WordPress covers more ways to track down problems.

Turn it off when you are done

Debug mode is a tool for fixing problems, not for everyday use. Once you solve the issue, set WP_DEBUG back to false and delete the old log file.

Warning

Never leave debug mode running on a live site for long. On many servers, anyone who knows the address of debug.log can open it, and it may reveal file paths and other details about your site.

[/notice]

Debug mode turns a mysterious problem into a clear error message you can act on. That's it. If an error in your log doesn't make sense, ask us about it in the comments below.