Why do I need a global environment constant?

In application.php what is the global environment constant used for and in what situations would I change it? Something simple is probably flying right over my head.

Outside of what is in the .env and environments what is this for and do I need to think about changing it to something like “production?”

/**
 * Set up our global environment constant and load its config first
 * Default: development
 */
define('WP_ENV', getenv('WP_ENV') ?: 'development');

Did you search the codebase for WP_ENV? You’d find one example of it used in both Bedrock and Sage.

Sometimes your code needs to know the environment it’s operating under and WP_ENV let’s you do that.

Thanks. I remember it being used in assets.php in Sage, but I don’t see it being used anymore.

I’ll take a look some more.

Actually that’s correct and I forgot about it. We should really remove the mentions of it. Thanks!