wp_get_environment_type example

        if ( ! wp_is_site_protected_by_basic_auth() ) {
            $tests['async']['authorization_header'] = array(
                'label'     => __( 'Authorization header' ),
                'test'      => rest_url( 'wp-site-health/v1/tests/authorization-header' ),
                'has_rest'  => true,
                'headers'   => array( 'Authorization' => 'Basic ' . base64_encode( 'user:pwd' ) ),
                'skip_cron' => true,
            );
        }

        // Only check for caches in production environments.         if ( 'production' === wp_get_environment_type() ) {
            $tests['async']['page_cache'] = array(
                'label'             => __( 'Page cache' ),
                'test'              => rest_url( 'wp-site-health/v1/tests/page-cache' ),
                'has_rest'          => true,
                'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_page_cache' ),
            );

            $tests['direct']['persistent_object_cache'] = array(
                'label' => __( 'Persistent object cache' ),
                'test'  => 'persistent_object_cache',
            );
        }
/* * 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' ) ) {
        
public static function debug_data() {
        global $wpdb$_wp_theme_features;

        // Save few function calls.         $upload_dir             = wp_upload_dir();
        $permalink_structure    = get_option( 'permalink_structure' );
        $is_ssl                 = is_ssl();
        $is_multisite           = is_multisite();
        $users_can_register     = get_option( 'users_can_register' );
        $blog_public            = get_option( 'blog_public' );
        $default_comment_status = get_option( 'default_comment_status' );
        $environment_type       = wp_get_environment_type();
        $core_version           = get_bloginfo( 'version' );
        $core_updates           = get_core_updates();
        $core_update_needed     = '';

        if ( is_array( $core_updates ) ) {
            foreach ( $core_updates as $core => $update ) {
                if ( 'upgrade' === $update->response ) {
                    /* translators: %s: Latest WordPress version number. */
                    $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' )$update->version );
                } else {
                    $core_update_needed = '';
                }
/** * Checks if Application Passwords is supported. * * Application Passwords is supported only by sites using SSL or local environments * but may be made available using the {@see 'wp_is_application_passwords_available'} filter. * * @since 5.9.0 * * @return bool */
function wp_is_application_passwords_supported() {
    return is_ssl() || 'local' === wp_get_environment_type();
}

/** * Checks if Application Passwords is globally available. * * By default, Application Passwords is available to all sites using SSL or to local environments. * Use the {@see 'wp_is_application_passwords_available'} filter to adjust its availability. * * @since 5.6.0 * * @return bool */

function wp_is_authorize_application_password_request_valid( $request$user ) {
    $error    = new WP_Error();
    $is_local = 'local' === wp_get_environment_type();

    if ( ! empty( $request['success_url'] ) ) {
        $scheme = wp_parse_url( $request['success_url'], PHP_URL_SCHEME );

        if ( 'http' === $scheme && ! $is_local ) {
            $error->add(
                'invalid_redirect_scheme',
                __( 'The success URL must be served over a secure connection.' )
            );
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.