WP_Role::__construct()
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.
Method of the class: WP_Role{}
No Hooks.
Return
null
. Nothing (null).
Usage
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.
Changelog
Since 2.0.0 | Introduced. |
WP_Role::__construct() WP Role:: construct code WP 6.6.1
public function __construct( $role, $capabilities ) { $this->name = $role; $this->capabilities = $capabilities; }