How to Enable Debug Mode in WordPress
Learn how to activate WordPress debug mode using WP_DEBUG and where to add the required code in the wp-config.php file.
WordPress developers working on themes or plugins may need to enable the WP_DEBUG feature to identify and fix errors during development. The built-in debugging system helps display PHP and WordPress-related issues that may not appear by default.
The WP_DEBUG constant is commonly used while developing or testing a WordPress theme or plugin. Since some PHP errors are hidden during normal operation, enabling debug mode is considered a recommended practice for development environments.
The following code can be used to activate WordPress debug mode and related logging features:
This setup allows developers to display errors directly on the screen and save them into a debug.log file located inside the wp-content directory.
Where to Add the Debug Code
The debug configuration code should be added to the wp-config.php file. This file is located in the root directory of a WordPress installation and contains the main configuration settings for the website.