get_role
Retrieve role object.
Description
(WP_Role|null) get_role( (string) $role );
Returns (WP_Role|null)
WP_Role object if found, null if the role does not exist.
Parameters (1)
- 0. $role (string)
- Role name.
Usage
if ( !function_exists( 'get_role' ) ) { require_once ABSPATH . WPINC . '/capabilities.php'; } // Role name. $role = ''; // NOTICE! Understand what this does before running. $result = get_role($role);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/capabilities.php
- function get_role( $role ) {
- returnwp_roles)->get_role( $role );
- }