WordPress at Your Fingertips
function is not described

WP_Role::__construct() public WP 2.0.0

Constructor - Set up object properties.

The list of capabilities must have the key as the name of the capability and the value a boolean of whether it is granted to the role.

{} It's a method of the class: WP_Role{}

No Hooks.


null. Nothing.


global $wp_role;
$wp_role->__construct( $role, $capabilities );
$role(string) (required)
Role name.
$capabilities(bool[]) (required)
Array of key/value pairs where keys represent a capability name and boolean values represent whether the role has that capability.


Since 2.0.0 Introduced.

Code of WP_Role::__construct() WP 5.8

public function __construct( $role, $capabilities ) {
	$this->name         = $role;
	$this->capabilities = $capabilities;