0
votes

How to create custom redirect after login? Suppose if we have redirect URL on the login page then redirect to redirect URL otherwise it redirects to the dashboard.

Example: login page URL is: http://example.com/login?redirect_url=http://example.com/xyz, in this case, it redirects to the http://example.com/xyz if the login the page URL is: http://example.com/login, at this point user redirect to the dashboard.

i've follow this url & Here is my code:

add_filter( 'login_redirect', 'redirect_admin');
function redirect_admin( $redirect_to, $request, $user ){ //is there a user to check?
if ( isset( $user->roles ) && is_array( $user->roles ) ) {

        $redirect_to = WP_HOME.'/quote-list/'; // Your redirect URL
}
return $redirect_to;
}

I'm using Frontend Dashboard plugin but this code is not working at my end.

1

1 Answers

0
votes

A solution it whould be to use the

Peter's Login Redirect

plugin, and specify where to redirect the user after log in