All Posts

Debugging to a file in WordPress post

When troubleshooting issues on a WordPress site, it is common to enable WP_DEBUG mode to get a closer look at errors as they happen. However, displaying errors to the screen is not always possible when working with public, heavily trafficked websites.

The WP_DEBUG constant comes in three parts, including the companion WP_DEBUG_LOG and WP_DEBUG_DISPLAY constants.

WP_DEBUG enables debug mode. By default this does not log errors and does display errors to the screen. The companion constants can override these defaults.

For example, to log errors, but not display them to the screen: