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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.