/**
* WP Snippet Press - Redirect After Login
*/
function wpsnippetpress_redirect_user( $redirect_to, $request, $user ) {
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
if ( in_array( 'administrator', $user->roles ) ) {
return admin_url();
} else {
return home_url('/dashboard');
}
}
return $redirect_to;
}
add_filter( 'login_redirect', 'wpsnippetpress_redirect_user', 10, 3 );PHP