get_role( string $role )

Retrieve role object.


Parameters

$role

(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

Changelog
Version Description
WP-2.0.0 Introduced.