Using WordPress Debug Constants

Here are some constants you can define in your wp-config.php file to assist with debugging.

Note that debugging should not be enabled on a production site, or if it is, it should be “silent” (i.e. writing to the log, but not displaying on the screen). Also for production use, keep in mind that debugging should be temporary. Constantly writing debug messages to the log will eventually slow your site down as the log grows larger. Leaving this on indefinitely could eventually crash the site when the log grows too large to handle.


This is the core WP constant that enables debugging. Setting this to true (see the example code at the end) will allow PHP error messages to be printed to the screen and/or the log. Used alone, without any of the additional constants will display errors, warnings, and notices to the screen but not to the error log file.


This constant is a companion to WP_DEBUG and it causes all errors to be written to a log file. By default, this log file will by located in /wp-content/debug.log.


This constant is a companion to WP_DEBUG and it causes all errors to be displayed on screen in the browser.


This little known constant is an important one for testing and debugging WordPress sites. When set to TRUE, it causes WP to load non-minified versions of CSS and JS files. If plugins or themes are properly constructed to WP standards, it will load non-minified versions of those assets as well.


This constant saves database queries to an array and that array can be displayed to help analyze them. It’s important to note that this constant has a definite performance impact and should only be used when actually debugging.

Leave a comment

Your email address will not be published. Required fields are marked *