0
我希望我的用戶註冊,自動登錄和重定向到在頭用戶拋出的鏈接像www.example.com/register/?redirect_to=/to/some/link&reauth=1
WordPress的註冊自動登錄以及自定義重定向
我已在\wp-content\plugins\theme-my-login-custom.php
的文件代碼如下: -
function auto_login_new_user($user_id) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id);
if(isset($_REQUEST['redirect_to']))
{
wp_redirect('/'.$_REQUEST['redirect_to']);
}
else
wp_redirect('/profile');
exit;
}
add_action('user_register', 'auto_login_new_user');
自動登錄工作正常,但我不能趕上變量redirect_to
重定向到被請求的頁面 ..
任何幫助將不勝感激..
-Thanks
可以詳細說明這一點,因爲我仍然在學習WP ... – user287332
試過它什麼都沒有發生.... – user287332
你可以添加'」轉換爲註冊表格?並填寫該值,而不是通過url發送並手動處理。請描述您如何創建註冊表單。 – keyBeatz