get_role( string $role ): WP_Role|null
Retrieves role object.
Parameters
-
$rolestring Required -
Role name.
Return
WP_Role|null WP_Role object if found, null if the role does not exist.
Source
File: wp-includes/capabilities.php.
View all references
function get_role( $role ) {
return wp_roles()->get_role( $role );
}
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Retrieve Admin Role Capabilities.
Sample Returned Object