WP_Roles::is_role() WordPress Method

The is_role() method is a static method of the WP_Roles class. This method can be used to check if a given role exists in the current WordPress installation.

WP_Roles::is_role( string $role ) #

Whether role name is currently in the list of available roles.


Parameters

$role

(string)(Required)Role name to look up.


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/class-wp-roles.php

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

Top ↑

Changelog

Changelog
VersionDescription
2.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.