I don't understand wordpress, why is this wp_get_environment_type
function undefined
?
Isn't this a "native" wordpress function? How can I make it defined? Here is my code inside of a MU-Plugin file:
add_action('admin_init', function() {
$environment = wp_get_environment_type();
//...
I don't understand wordpress, why is this wp_get_environment_type
function undefined
?
Isn't this a "native" wordpress function? How can I make it defined? Here is my code inside of a MU-Plugin file:
add_action('admin_init', function() {
$environment = wp_get_environment_type();
//...
Share
Improve this question
asked Jan 18, 2021 at 21:04
now_worldnow_world
1155 bronze badges
1 Answer
Reset to default 5It is a core WP function, but only after WordPress version 5.5.0.
If you're using an older version of WordPress, it won't exist yet.
Do this:
add_action('admin_init', function() {
if ( ! function_exists( 'wp_get_environment_type' ) ) {
return;
}
$environment = wp_get_environment_type();
//...
Or, better still, make sure your WordPress installation is up to date.