WordPress environment types

In WordPress 5.5 we introduced the new wp_get_environment_type function which allows retrieving the type of environment the current system is. We originally allowed changing the environment types, which we’ve decided is a mistake. It makes it so that plugins and themes can’t rely on any given environment being one of a limited and known list of types, and thus can’t rely on the feature.

For this reason, as of WordPress 5.5.1 it will no longer be possible to override the list of possible environment types.

Which environment types do we have?

The following environment types will be supported as of 5.5.1:

  • production – this is the default. A site that is running live, connected to the internet and reachable on the internet.
  • staging – this is what you would use for staging environments, probably both connected to and reachable on the internet.
  • development – this is what you would use for development environments that are reachable on the internet, we automatically enable WP_DEBUG on environments where this is the environment type.
  • local – added in 5.5.1, this (usually development) environment can reach the internet but is not be reachable from the internet.

By limiting the set of environment types in this way, WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress., plugins, and themes can change their behavior depending on this setting.

What happens if you changed the setting?

If you’d already set an environment variable to allow changing the environment types, this will no longer function. If you’d set the WP_ENVIRONMENT_TYPE constant to something else than one of the four allowed environment types, it will reset to production.

Props @johnbillion, @audrasjb, and @sergeybiryukov for reviewing.

#5-5-1, #dev-notes