When you need to direct a particular user to a certain page based on their role in WordPress, you don’t need to spend money on a redirect plugin – just put the following code in your function.php file.

For instance, if you want all Subscribers to be redirected to their Dashboard.

 function login_redirect_based_on_roles($user_login, $user) {
    if( in_array( 'subscriber',$user->roles ) ){
        exit( wp_redirect('Your page link goes here' ) );
add_action( 'wp_login', 'login_redirect_based_on_roles', 10, 2);


more similar articles