WP_Roles::is_role()publicWP 2.0.0

Determines whether a role name is currently in the list of available roles.

Method of the class: WP_Roles{}

No Hooks.

Return

true|false.

Usage

global $wp_roles;
$wp_roles->is_role( $role );
$role(string) (required)
Role name to look up.

Changelog

Since 2.0.0 Introduced.

WP_Roles::is_role() code WP 6.1.1

public function is_role( $role ) {
	return isset( $this->role_names[ $role ] );
}