WordPress获取当前登录用户的ID
include("wp-config.php"); // code by golbz
function wt_get_user_id(){
global $userdata;
get_currentuserinfo();
return $userdata->ID;
}
$loginuserid = wt_get_user_id();
貌似这个代码在Google上比较难找?反正我找了半天,整理出来,以免以后忘记了
include("wp-config.php"); // code by golbz
function wt_get_user_id(){
global $userdata;
get_currentuserinfo();
return $userdata->ID;
}
$loginuserid = wt_get_user_id();
貌似这个代码在Google上比较难找?反正我找了半天,整理出来,以免以后忘记了