WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp debug mode

Description

Sets PHP error handling and handles WordPress debug mode.

Uses three constants: WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG. All three can be defined in wp-config.php. Example:

define( 'WP_DEBUG', true );

WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true. WP_DEBUG defaults to false.

When WP_DEBUG is true, all PHP notices are reported. WordPress will also display notices, including one when a deprecated WordPress function, function argument, or file is used. Deprecated code may be removed from a later version.

It is strongly recommended that plugin and theme developers use WP_DEBUG in their development environments.

When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed. WP_DEBUG_DISPLAY defaults to true. Defining it as null prevents WordPress from changing the global configuration setting. Defining WP_DEBUG_DISPLAY as false will force errors to be hidden.

When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log. WP_DEBUG_LOG defaults to false.

Usage

<?php wp_debug_mode(); ?>

Change Log

Since: 3.0

Source File

wp_debug_mode() is located in wp-includes/load.php

Related

Debugging in WordPress