[英]How to redirect the user to another location after login WordPress?
I am trying to make a plugin, I need to redirect user to another page or location instead of dashboard.我正在尝试制作一个插件,我需要将用户重定向到另一个页面或位置而不是仪表板。 I tried few action or filter hook but none of them work for me.
我尝试了一些动作或过滤器钩子,但没有一个对我有用。 Please help me by sharin code or tutorial.
请通过共享代码或教程帮助我。
function redirect_function() {
wp_redirect('http://google.com');
die();
}
add_action('wp_login', 'redirect_function');
// add_filter('login_redirect', 'redirect_function', 10, 3);
You can try code below:您可以尝试以下代码:
function redirect_on_login() {
$some_url = 'some url';
wp_redirect( $some_url );
exit;
}
add_action( 'wp_login', 'redirect_on_login', 1 );
Also you can check the Documentation您也可以查看文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.