Redirect dont work
-
Hello all,
I want after the log in to redirect the Store Vendor and the customer to two different url. I used in the snippet code plug in the code below, bur it doesn’t work.
add_filter( ‘user_registration_login_redirect’, ‘ur_redirect_back’, 10, 2 );function ur_redirect_back( $redirect_url, $user ) {
$current_user = (object) $user;
$roles = isset( $current_user->roles ) ? (array) $current_user->roles : array();
if ( in_array( ‘Store Vendor’, $roles, true ) ) {
$redirect_url = ‘https://my-site.com/store-manager’;
} elseif ( in_array( ‘customer’, $roles, true ) ) {
$redirect_url = ‘https://my-site.com/home’;
}
return $redirect_url;
}*redirect_url : I put the url of the page that I want
Do you have any idea?Thank you!
- The topic ‘Redirect dont work’ is closed to new replies.