WP_Roles::get_role()publicWP 2.0.0

Retrieves a role object by name.

Метод класса: WP_Roles{}

Хуков нет.

Возвращает

WP_Role|null. WP_Role object if found, null if the role does not exist.

Использование

global $wp_roles;
$wp_roles->get_role( $role );
$role(строка) (обязательный)
Role name.

Список изменений

С версии 2.0.0 Введена.

Код WP_Roles::get_role() WP 6.5.2

public function get_role( $role ) {
	if ( isset( $this->role_objects[ $role ] ) ) {
		return $this->role_objects[ $role ];
	} else {
		return null;
	}
}