This article was published on WordPress.org
WP_DEBUG is a PHP constant (a permanent global variable) that can be used to trigger the “debug” mode throughout WordPress.
It is assumed to be false by default and is usually set to true in the wp-config.php file on development copies of WordPress.
// This enables debugging.
define( 'WP_DEBUG', true );
// This disables debugging.
define( 'WP_DEBUG', false );
Note: The true and false values in the example are not surrounded by apostrophes (‘) because they are boolean (true/false) values. If you set constants to ‘false’, they will be interpreted as true because the quotes make it a string rather than a boolean.
It is not recommended to use WP_DEBUG or the other debug tools on live sites; they are meant for local testing and staging installs.
PHP Errors, Warnings, and Notices
Enabling WP_DEBUG will cause all PHP errors, notices and warnings to be displayed.
This is likely to modify the default behavior of PHP which only displays fatal errors and/or shows a white screen of death when errors are reached.
Showing all PHP notices and warnings often results in error messages for things that don’t seem broken, but do not follow proper data validation conventions inside PHP.
These warnings are easy to fix once the relevant code has been identified, and the resulting code is almost always more bug-resistant and easier to maintain.
Deprecated Functions and Arguments
Enabling WP_DEBUG will also cause notices about deprecated functions and arguments within WordPress that are being used on your site.
These are functions or function arguments that have not been removed from the core code yet but are slated for deletion in the near future. D
Deprecation notices often indicate the new function that should be used instead.
