WordPress has a special debug mode that can be used to log error messages of the server-side scripting language PHP, in which much of the WordPress logic is programmed.
By default the mode is not activated and this is a fine, because it should only be switched on for troubleshooting and then switched off again.
Activating the Debug Mode
To activate the debug mode, open your configuration file
wp-config.php in the root directory of your site in a text editor. Scroll down to this line:
false means that the mode is not activated.
Replace this line with the following:
define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
Setting this to
true switches the mode on in general. Important in this context are the two new values.
If set to
WP_DEBUG_LOG ensures that any error messages that occur are logged in a server-side file. The file is created in the
wp-content directory of your site with the default name
debug.log. So make sure that this directory is writable for the PHP process or create the file manually and give it write permission (664).
For a productive site it is very important to set the third value
false, because it ensures that the error messages are not displayed in the frontend of your site.
Deactivating the Debug Mode
When the debugging is finished, it is important to switch off the debug mode again. Otherwise the log file would continue to be bloated with unnecessary entries.
To switch off the WordPress debug mode, set the value
WP_DEBUG back to
false as in the initial state.
Short URL: http://bit.ly/asa2-wp-debug-mode
Check out more WordPress Tutorials
- Black Friday Sale 2023 – 33% discount code for ASA2! - November 22, 2023
- ASA2 update 1.19.0 brings improvements for the Product Picker - November 21, 2023
- ASA2 update 1.18.0 brings support for merchant information - October 21, 2023