How To Enable WordPress Debugging
If you are attempting to debug an issue on your WordPress installation, it will be very useful to enable the debugging to get a deeper look into any errors which may be getting thrown. By default, WordPress is not enabled to display or log errors. Debugging can be turned on by setting a few options in the wp-config.php file.
To enable debugging, open your wp-config.php file and find:
Change this line to:
This will allow WordPress to display errors to the screen as they occur. Please note that this may reveal important information to users and can pose a security risk. It is advised to see one of the options below capture errors more safetly.
Logging Errors to a File
It is recommended to log your errors to a file instead of displaying them on the screen. WordPress by default will display errors to the screen when WP_DEBUG is enabled. This section will cover both hiding these errors and turning on file logging.
To turn off the display of errors, you must add the WP_DEBUG_DISPLAY flag to your wp-config.php file. Below the WP_DEBUG line found above, add in the following line:
Now that we have debugging turned on and the display of errors off, we will need to enable logging to a file so we can retrieve the errors safely. By default, your error log will be found in /wp-content/debug.log. In your wp-config.php, add the following line below the two added above:
Example wp-config.php for Debugging
This is an example wp-config.php used for debugging. The display of errors are set to false and file logging is enabled.
// Enables Debugging
// Enable Debug logging to the /wp-content/debug.log file
// Disable display of errors and warnings
Article ID: 2314, Created: November 26, 2015 at 11:03 PM, Modified: November 26, 2015 at 11:08 PM