has_cap( $role ) ) return true; /* Return false if the user doesn't have the role. */ return false; } } if ( !function_exists( 'current_user_has_role' ) ) { /** * Checks if the currently logged-in user has a specific role. * * @since 0.1 * @uses current_user_can() Checks whether the user has the given role. * @param $role string The role to check for. * @return true|false bool Whether the user has the role. */ function current_user_has_role( $role = '' ) { /* If no role was input, return false. */ if ( !$role ) return false; /* If the current user has the role, return true. */ if ( current_user_can( $role ) ) return true; /* If the current user doesn't have the role, return false. */ return false; } } ?>