How to locate and modify the ‘WP_ENVIRONMENT_TYPE’ global system variable
-
@desrosj In a local development site ( Local by WPEngine ), I’ve been exploring the function
wp_get_environment_type()
added in WordPress v5.5 . The function returns a value of ‘local’.Stepping through and inspecting the conditional checks within the function, the return value appears to be set by a globally defined constant WP_ENVIRONMENT_TYPE. However, I can’t identify where that constant is set within WordPress. Looking at the local server information for my development site via
phpinfo()
did not return any information on the constant WP_ENVIRONMENT_TYPE.Reassigning the function in
/wp-config.php
to a different value (e.g. ‘development’ === wp_get_environment_type() ), or defining the constant ( e.g. define( ‘WP_ENVIRONMENT_TYPE’, ‘development’ ); ) in that file has no effect.Result: the conditional check to define WP_DEBUG as true in
/wp-includes/default-constants.php
L#77 never runs.Question 1: Where is the global constant WP_ENVIRONMENT_TYPE being set either in WordPress, or on my local development server ( nginx on Local by WPEngine )?
Question 2: Is is possible to modify the value currently returned by
wp_get_environment_type()
? If so, where and how should this be done?
- The topic ‘How to locate and modify the ‘WP_ENVIRONMENT_TYPE’ global system variable’ is closed to new replies.