我正在尝试使用函数wp_get_current_user()获取插件中的当前用户信息。但是我得到了Call to undefined function wp_get_current_user()
显然,这是因为包含函数的文件/wp-includes/pluggable直到插件加载之后才会加载任何人有任何想法如何在我的插件中获得用户详细信息?
WordPress具有诸如wp_get_current_user()之类的全局函数,wp_get_current_user()可以在类方法中调用这些函数,这些方法与\wp_get_current_user位于不同的命名空间。但是,,我不能在类构造函数中这样做,也不能将它设置为变量(类属性,如$user = \wp_get_current_user)。我猜这里有一个我不知道的PHP规则?because we have to initia