Function: get_role

get_role( string $role )

Retrieve role object.

Parameters

Name Type(s) Default Value Description
$role string

Role name.

Returns

WP_Role | null

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

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.