3
我在登錄後遇到此重定向問題。我在註冊中添加了一個額外的字段,然後在那之後。如果用戶登錄,我想根據他/她輸入的EXTRA FIELD將該人重定向到指定的URL。如何根據wp用戶元密鑰登錄後重定向用戶?
謝謝!
我在登錄後遇到此重定向問題。我在註冊中添加了一個額外的字段,然後在那之後。如果用戶登錄,我想根據他/她輸入的EXTRA FIELD將該人重定向到指定的URL。如何根據wp用戶元密鑰登錄後重定向用戶?
謝謝!
考慮到您使用的是update_usermeta($user_id, $meta_key, $meta_value);
,以下操作將會執行。
我創建了一個名爲custom profile field和twitter
應用此掛鉤wp_login
:
add_action('wp_login', 'redirect_login_so_21774306', 10, 2);
function redirect_login_so_21774306($user_login, $user)
{
$twitter = get_the_author_meta('twitter', $user->data->ID);
if($twitter)
{
wp_redirect(site_url("custom-post/?twitter=$twitter", 'http'), 301);
exit;
}
}