Adds a capability to role.
Parameters
$role
stringrequired- Role name.
$cap
stringrequired- Capability name.
$grant
booloptional- Whether role is capable of performing capability.
Default:
true
Source
public function add_cap( $role, $cap, $grant = true ) {
if ( ! isset( $this->roles[ $role ] ) ) {
return;
}
$this->roles[ $role ]['capabilities'][ $cap ] = $grant;
if ( $this->use_db ) {
update_option( $this->role_key, $this->roles );
}
}
Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.