#60781 closed enhancement (wontfix)
Expand or modify wp_get_environment_type function to allow more environment types
Reported by: | dingo_d | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.5.1 |
Component: | Bootstrap/Load | Keywords: | |
Focuses: | Cc: |
Description
Currently the wp_get_environment_type() function only allows 4 environment types:
$wp_environments = array(
'local',
'development',
'staging',
'production',
);
But there are projects that have multiple environment types (CI, CD, pre-production, UAT, etc.).
So if you define the WP_ENVIRONMENT_TYPE
to anything outside of these 4 environments, you'll end up with serving the production
environment.
A trivial example would be where you'd like to change the color of your admin UI based on environments. I mean, sure you can use something like defined('WP_ENVIRONMENT_TYPE') ? WP_ENVIRONMENT_TYPE : 'production'
, but what's the point of the wp_get_environment_type
function then?
One alternative is to expand the $wp_environments
variable with some of the industry most-used terms. Or just remove this check, and just return the value of defined('WP_ENVIRONMENT_TYPE') ? WP_ENVIRONMENT_TYPE : 'production'
check.
See #50992 and related discussions where this was deliberately changed.