Skip to content

Instantly share code, notes, and snippets.

@Clorith
Created November 27, 2014 09: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 Clorith/2f6a0c1f8e949d97486b to your computer and use it in GitHub Desktop.
Save Clorith/2f6a0c1f8e949d97486b to your computer and use it in GitHub Desktop.
<?php
function login_redirection( $redirect_to, $request, $user ) {
global $user;
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
if ( in_array( 'administrator', $user->roles ) || in_array( 'editor', $user->roles ) ) {
return $redirect_to;
}
else {
return home_url( '/dekk/' );
}
}
else {
return $redirect_to;
}
}
add_filter( 'login_redirect', 'login_redirection', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment