Skip to content

Instantly share code, notes, and snippets.

@ThePixelPixie
Created October 6, 2015 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThePixelPixie/06799dff1d7a5924107c to your computer and use it in GitHub Desktop.
Save ThePixelPixie/06799dff1d7a5924107c to your computer and use it in GitHub Desktop.
// Custom remove admin login redirect
function admin_login_redirect( $redirect_to, $request, $user )
{
global $user;
if( isset( $user->roles ) && is_array( $user->roles ) ) {
if( in_array( "administrator", $user->roles ) ) {
return $redirect_to;
} else {
return home_url();
}
}
else
{
return $redirect_to;
}
}
add_filter("login_redirect", "admin_login_redirect", 10, 3);
// END custom remove admin login redirect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment