WordPress WP_DEBUG Code Generator for wp-config.php
Turn on the debug log without breaking your live site
Runs in your browser. Nothing is uploaded.
About the WordPress WP_DEBUG Code Generator for wp-config.php
A free WP_DEBUG code generator for wp-config.php: it builds the WP_DEBUG constants that write errors to a log file instead of printing them to your visitors. The default WP_DEBUG snippet most sites copy will display PHP errors publicly — this one will not.
New to debug mode? Our WordPress debug mode guide explains what WP_DEBUG, WP_DEBUG_LOG and WP_DEBUG_DISPLAY each do, and how to turn debug mode off again.
When you need it
Use it when something breaks and WordPress will not say why: a white screen, a "critical error" email, a plugin that stops saving settings. WP_DEBUG is off by default, so most PHP warnings and notices are never recorded anywhere until you turn it on.
How to use it
- Pick live or local/staging above, then copy the constants.
- Open wp-config.php and paste them above the line that says "That's all, stop editing! Happy publishing." (older installs say "Happy blogging") Anything below that line is too late to count.
- Reproduce the problem by loading the broken page again.
- Open wp-content/debug.log, or the custom path you set, and read the newest lines at the bottom. Our debug.log location guide covers hosts that put it somewhere else.
Common mistakes
- Writing
'false'in quotes. WordPress reads a quoted string as true, so debugging stays on. - Turning on WP_DEBUG without setting WP_DEBUG_DISPLAY to false. Its default is true, which prints errors, including file paths, into your pages.
- Leaving it all on afterwards. The WordPress handbook says these tools are meant for local and staging sites, and SAVEQUERIES slows every request.
- Leaving debug.log in wp-content. If your server does not block it, anyone who guesses the URL can read it.
FAQ
Questions
Is it safe to enable WP_DEBUG on a live site?
Only with WP_DEBUG_DISPLAY set to false. On its own, WP_DEBUG prints PHP notices and warnings — including your server's absolute file paths — directly into pages your visitors load. Almost every tutorial hands you that one line and stops. Pair it with WP_DEBUG_LOG and WP_DEBUG_DISPLAY false and it is safe.
Where does the WordPress debug log go?
wp-content/debug.log by default. Worth knowing: on many hosts that file is publicly fetchable — anyone can request it in a browser. You can pass a path to WP_DEBUG_LOG instead and write the log above the web root, which this tool will generate for you.
I set WP_DEBUG to true and nothing happened. Why?
Almost always because the constant was added BELOW the line that says "That's all, stop editing!" in wp-config.php. Everything after that line is ignored. Move it above.