WP_Roles::get_role( string $role )

Retrieve role object by name.


Description Description


Parameters Parameters

$role

(string) (Required) Role name.


Top ↑

Return Return

(WP_Role|null) WP_Role object if found, null if the role does not exist.


Top ↑

Source Source

File: wp-includes/class-wp-roles.php

	public function get_role( $role ) {
		if ( isset( $this->role_objects[ $role ] ) ) {
			return $this->role_objects[ $role ];
		} else {
			return null;
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.