WordPress at a glance
function is not described

WP_Roles::get_role() public WP 2.0.0

Retrieve role object by name.

{} It's a method of the class: WP_Roles{}

No Hooks.

Return

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

Usage

global $wp_roles;
$wp_roles->get_role( $role );
$role(string) (required)
Role name.

Changelog

Since 2.0.0 Introduced.

Code of WP_Roles::get_role() WP 5.7.2

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