我的mu-plugins.php
文件和is_super_admin()
函数未正确生成true。
我正在运行v4。2.4
function check_for_superAdmin() {
if ( is_super_admin() ) { echo \'I\\\'m a Super Admin !\'; exit; }
}
add_action( \'wp_login\', \'check_for_superAdmin\' );
有人知道为什么吗?Notes:
<我登录于http://example.com/wp-admin/networkhttp://example.com/wp-adminSuper Admin 在网络管理>用户列表中Interesting
以下代码为current user login username
. 我想知道我的钩子是否放错地方了。function check_for_superAdmin() {
$curUser = wp_get_current_user();
echo $curUser->user_login . \' is the user\';
exit;
if ( is_super_admin() ) { echo \'I am the Super Admin !\'; exit; }
}
add_action( \'wp_login\', \'check_for_superAdmin\' );
Additional Notes:
function check_for_superAdmin($user_login, $user) {
//$current_user = wp_get_current_user(); // THIS DOES NOT FIND THE CURRENT USER
//echo $user_login; // THIS ACCURATELY SHOWS THE LOGGED IN USER
//echo $user; // THIS THROWS A SERVER 500 ERROR
}
add_action( \'wp_login\', \'check_for_superAdmin\', 10, 2 );
$current_user = wp_get_current_user();
在上述函数()中不起作用$user_login
在上述函数()内工作$user
导致服务器500错误