Skip to content

Instantly share code, notes, and snippets.

@curtismchale
Created November 2, 2011 22:32
Show Gist options
  • Save curtismchale/1335145 to your computer and use it in GitHub Desktop.
Save curtismchale/1335145 to your computer and use it in GitHub Desktop.
redirect on user role
// Redirect admins to the dashboard and other users elsewhere
add_filter( 'login_redirect', 'sfn_tan_login_redirect', 10, 3 );
function sfn_tan_login_redirect( $redirect_to, $request, $user ) {
// Is there a user?
if ( is_array( $user->roles ) ) {
// Is it an administrator?
if ( in_array( 'athlete', $user->roles ) )
return home_url( '/dashboard/' );
else
return home_url();
// return get_permalink( 83 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment