admin管理员组文章数量:1307509
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.
本文标签: pluginswpgetenvironmenttype is undefined
版权声明:本文标题:plugins - wp_get_environment_type is undefined 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741824481a2399563.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论