get_role() WordPress Function
The get_role() function is used to get a role object by its name.
get_role( string $role ) #
Retrieves role object.
Parameters
- $role
(string)(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
function get_role( $role ) { return wp_roles()->get_role( $role ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |