WP_Roles::get_role( string $role ): WP_Role|null

In this article

Retrieves a role object by name.

Parameters

$rolestringrequired
Role name.

Return

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

Source

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

Changelog

VersionDescription
2.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.