我在WORDPRESS中使用Ultimate成員插件。並且該插件具有在FRONT END上切換用戶帳戶的功能,通過單擊以該用戶身份登錄但突然停止工作,並且它不工作。WordPress的wp_set_current_user不工作
我發現,它最終使用這些文件中的代碼:
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id, $rememberme);
// echo get_current user_id();
// here i am getting new user id;
$redirect_to = 'some url';
wp_safe_redirect($redirect_to);
exit();
但重定向後,我沒有被切換到新的用戶,但管理之前它返回新的用戶ID。
因爲我沒有使用任何緩存。
在此先感謝。