wp_get_development_mode

The timeline below displays how wordpress function wp_get_development_mode has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Retrieves the current development mode.
 *
 * The development mode affects how certain parts of the WordPress application behave,
 * which is relevant when developing for WordPress.
 *
 * Development mode can be set via the `WP_DEVELOPMENT_MODE` constant in `wp-config.php`.
 * Possible values are 'core', 'plugin', 'theme', 'all', or an empty string to disable
 * development mode. 'all' is a special value to signify that all three development modes
 * ('core', 'plugin', and 'theme') are enabled.
 *
 * Development mode is considered separately from `WP_DEBUG` and wp_get_environment_type().
 * It does not affect debugging output, but rather functional nuances in WordPress.
 *
 * This function retrieves the currently set development mode value. To check whether
 * a specific development mode is enabled, use wp_is_development_mode().
 *
 * @since 6.3.0
 *
 * @return string The current development mode.
 */
function wp_get_development_mode()
{
    static $current_mode = null;
    if (!defined('WP_RUN_CORE_TESTS') && null !== $current_mode) {
        return $current_mode;
    }
    $development_mode = WP_DEVELOPMENT_MODE;
    // Exclusively for core tests, rely on the `$_wp_tests_development_mode` global.
    if (defined('WP_RUN_CORE_TESTS') && isset($GLOBALS['_wp_tests_development_mode'])) {
        $development_mode = $GLOBALS['_wp_tests_development_mode'];
    }
    $valid_modes = array('core', 'plugin', 'theme', 'all', '');
    if (!in_array($development_mode, $valid_modes, true)) {
        $development_mode = '';
    }
    $current_mode = $development_mode;
    return $current_mode;
}