How to redirect a specific user after log-in?

You need to use the login_redirect filter returning the redirect location:

add_filter( 'login_redirect', 'redirect_to_home', 10, 3 );
function redirect_to_home( $redirect_to, $request, $user ) {

    if( $user->ID == 6 ) {
        //If user ID is 6, redirect to home
        return get_home_url();
    } else {
        //If user ID is not 6, leave WordPress handle the redirection as usual
        return $redirect_to;
    }

}

Leave a Comment