Enable WordPress Debugging For Efficient Plugin Development

Enable WP_DEBUG and start seeing PHP notices and also WordPress-generated debug messages. This is helpful when building plugins. WP_DEBUG tells PHP to report more errors, specifically “notices,” since WordPress normally instructs PHP to only report warnings and fatal errors. It also will help you to know if you’re using a deprecated function, deprecated file, or an old API.

Simply open wp-config.php and define:

1
define( 'WP_DEBUG', true );

You can also define WP_DEBUG_DISPLAY and WP_DEBUG_LOG to suppress the notices and log them to a wp-content/debug.log file if you’re debugging on a production site:

1
2
3
4
define( 'WP_DEBUG', true ); 
define( 'WP_DEBUG_LOG', true ); 
define( 'WP_DEBUG_DISPLAY', false ); 
ini_set( 'display_errors', 0 );