kundius

WP_check_user_role

Jun 19th, 2014
708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.27 KB | None | 0 0
  1. function check_user_role( $role, $user_id = null ) {
  2.     if(is_numeric($user_id))
  3.         $user = get_userdata($user_id);
  4.     else
  5.         $user = wp_get_current_user();
  6.  
  7.     if(empty($user))
  8.         return false;
  9.  
  10.     return in_array( $role, (array) $user->roles );
  11. }
Advertisement
Add Comment
Please, Sign In to add comment