get_role( string $role ): WP_Role|null
- Since
- 2.0.0
- Source
wp-includes/capabilities.php:1098
Retrieves role object.
Parameters
$rolestring- Role name.
Return
WP_Role|null- WP_Role object if found, null if the role does not exist.
Uses · 2
- wp_roles()Retrieves the global WP_Roles instance and instantiates it if necessary.
- wp_roles()::get_role()
Used by · 10
- populate_roles_160()Create the roles for WordPress 2.0
- populate_roles_210()Create and modify WordPress roles for WordPress 2.1.
- populate_roles_230()Create and modify WordPress roles for WordPress 2.3.
- populate_roles_250()Create and modify WordPress roles for WordPress 2.5.
- populate_roles_260()Create and modify WordPress roles for WordPress 2.6.
- populate_roles_270()Create and modify WordPress roles for WordPress 2.7.
- populate_roles_280()Create and modify WordPress roles for WordPress 2.8.
- populate_roles_300()Create and modify WordPress roles for WordPress 3.0.
- sanitize_option()Sanitizes various option values based on the nature of the option.
- wp_xmlrpc_server::wp_getUsers()Retrieves users.
Source
function get_role( $role ) { return wp_roles()->get_role( $role );}History
Introduced in 2.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/capabilities.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.