get_role( string $role )

Retrieves 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
2.0.0 Introduced.