Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('login_redirect', 'admin_login_redirect', 10, 3);
- 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 Comment
Please, Sign In to add comment