Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#60781 closed enhancement (wontfix)

Expand or modify wp_get_environment_type function to allow more environment types

Reported by: dingo_d Owned by:
Priority: normal Milestone:
Component: Bootstrap/Load Version: 5.5.1
Severity: normal Keywords:
Cc: Focuses:

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
2 years ago

  • Version5.5.1

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

#2 @dingo_d
2 years ago

  • Resolutioninvalid
  • Status newclosed

#3 @desrosj
2 years ago

  • Keywords 2nd-opinion dev-feedback removed
  • Milestone Awaiting Review
  • Resolution invalidwontfix

Changing to wontfix since this was an intentional decision.

Note: See TracTickets for help on using tickets.