WordPress.org

Make WordPress Core

Changeset 48662


Ignore:
Timestamp:
07/28/2020 12:08:41 PM (8 weeks ago)
Author:
SergeyBiryukov
Message:

Bootstrap/Load: Remove the wp_environment_type and wp_get_environment_type filters.

Since wp_get_environment_type() runs too early for plugins to hook these filters, and the result is then cached in a static variable and cannot be changed later, the filters are not that useful.

The WP_ENVIRONMENT_TYPES and WP_ENVIRONMENT_TYPE constants and environment variables should be enough for now.

Follow-up to [47919], [48188], [48372].

Props Clorith, SergeyBiryukov.
Fixes #33161.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r48206 r48662  
    133133 *
    134134 * The type can be set via the `WP_ENVIRONMENT_TYPE` global system variable,
    135  * a constant of the same name, or the {@see 'wp_get_environment_type'} filter.
     135 * or a constant of the same name.
    136136 *
    137137 * Possible values include 'development', 'staging', 'production'. If not set,
     
    168168    }
    169169
    170     /**
    171      * Filters the list of supported environment types.
    172      *
    173      * This filter runs before it can be used by plugins. It is designed for non-web runtimes.
    174      *
    175      * @since 5.5.0
    176      *
    177      * @param array $wp_environments The list of environment types. Possible values
    178      *                               include 'development', 'staging', 'production'.
    179      */
    180     $wp_environments = apply_filters( 'wp_environment_types', $wp_environments );
    181 
    182170    // Check if the environment variable has been set, if `getenv` is available on the system.
    183171    if ( function_exists( 'getenv' ) ) {
     
    192180        $current_env = WP_ENVIRONMENT_TYPE;
    193181    }
    194 
    195     /**
    196      * Filters the current environment type.
    197      *
    198      * This filter runs before it can be used by plugins. It is designed for
    199      * non-web runtimes. The value returned by this filter has a priority over both
    200      * the `WP_ENVIRONMENT_TYPE` system variable and a constant of the same name.
    201      *
    202      * @since 5.5.0
    203      *
    204      * @param string $current_env The current environment type. Possible values
    205      *                            include 'development', 'staging', 'production'.
    206      */
    207     $current_env = apply_filters( 'wp_get_environment_type', $current_env );
    208182
    209183    // Make sure the environment is an allowed one, and not accidentally set to an invalid value.
Note: See TracChangeset for help on using the changeset viewer.