wp_get_development_mode example

/* * Add define( 'WP_DEVELOPMENT_MODE', 'core' ), or define( 'WP_DEVELOPMENT_MODE', 'plugin' ), or * define( 'WP_DEVELOPMENT_MODE', 'theme' ), or define( 'WP_DEVELOPMENT_MODE', 'all' ) to wp-config.php * to signify development mode for WordPress core, a plugin, a theme, or all three types respectively. */
    if ( ! defined( 'WP_DEVELOPMENT_MODE' ) ) {
        define( 'WP_DEVELOPMENT_MODE', '' );
    }

    // Add define( 'WP_DEBUG', true ); to wp-config.php to enable display of notices during development.     if ( ! defined( 'WP_DEBUG' ) ) {
        if ( wp_get_development_mode() || 'development' === wp_get_environment_type() ) {
            define( 'WP_DEBUG', true );
        } else {
            define( 'WP_DEBUG', false );
        }
    }

    /* * Add define( 'WP_DEBUG_DISPLAY', null ); to wp-config.php to use the globally configured setting * for 'display_errors' and not force errors to be displayed. Use false to force 'display_errors' off. */
    if ( ! defined( 'WP_DEBUG_DISPLAY' ) ) {
        


/** * Checks whether the site is in the given development mode. * * @since 6.3.0 * * @param string $mode Development mode to check for. Either 'core', 'plugin', 'theme', or 'all'. * @return bool True if the given mode is covered by the current development mode, false otherwise. */
function wp_is_development_mode( $mode ) {
    $current_mode = wp_get_development_mode();
    if ( empty( $current_mode ) ) {
        return false;
    }

    // Return true if the current mode encompasses all modes.     if ( 'all' === $current_mode ) {
        return true;
    }

    // Return true if the current mode is the given mode.     return $mode === $current_mode;
}
Home | Imprint | This part of the site doesn't use cookies.