Naijaping

Redirect non-admins to a custom page after login

Mar 23rd, 2014
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. function omoba_login_redirect($redirect_to, $request, $user)
  2. {
  3.  
  4. return (is_array($user->roles) && in_array('administrator', $user->roles)) ? admin_url() : '/YOUCUSTOMPAGE';
  5.  
  6. }
  7.  
  8. add_filter( 'login_redirect', 'omoba_login_redirect', 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment