Last active
June 28, 2017 13:21
-
-
Save mateusneves/21ff3addce9fa971757597ea25e93249 to your computer and use it in GitHub Desktop.
Redirect after Login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function redirect_users_by_role($redirect_to, $request, $user) { | |
return ( is_array( $user->roles ) && in_array( 'administrator', $user->roles ) ) ? admin_url() : home_url(); | |
} // cm_redirect_users_by_role | |
add_action( 'login_redirect', 'redirect_users_by_role', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment