Make WordPress Core

Opened 5 months ago

Closed 3 months ago

Last modified 3 months ago

#60781 closed enhancement (wontfix)

Expand or modify wp_get_environment_type function to allow more environment types

Reported by: dingo_d's profile 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.

Change History (3)

#1 @swissspidy
5 months ago

  • Version set to 5.5.1

See #50992 and related discussions where this was deliberately changed.

#2 @dingo_d
3 months ago

  • Resolution set to invalid
  • Status changed from new to closed

#3 @desrosj
3 months ago

  • Keywords 2nd-opinion dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution changed from invalid to wontfix

Changing to wontfix since this was an intentional decision.

Note: See TracTickets for help on using tickets.