Wordpress Plugin - Conditional Redirect after Login based on WP role


Could you suggest a way to redirect to different URLs after logging in based on WP role?



Best Answer

  • Richard_KwanRichard_KwanMember
    Answer ✓
    Never mind, I found the answer:

    //Redirection for existing users
    function oa_social_login_set_redirect_url_existing_users ($url, $user_data)
    //Force the url to something else
    $url = 'http://my-website.com/welcome-back/';

    //Returning users will be redirected here
    return $url;
    add_filter('oa_social_login_filter_login_redirect_url', 'oa_social_login_set_redirect_url_existing_users', 10, 2);
    Sign In or Register to comment.