W3cubDocs

/WordPress

get_role( string $role )

Retrieve 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 );
}

Changelog

Version Description
2.0.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_role