WP_Roles::remove_cap
Removes a capability from role.
Method of the class: WP_Roles{}
No Hooks.
Returns
null. Nothing (null).
Usage
global $wp_roles; $wp_roles->remove_cap( $role, $cap );
- $role(string) (required)
- Role name.
- $cap(string) (required)
- Capability name.
Changelog
| Since 2.0.0 | Introduced. |
WP_Roles::remove_cap() WP Roles::remove cap code WP 7.0
public function remove_cap( $role, $cap ) {
if ( ! isset( $this->roles[ $role ] ) ) {
return;
}
unset( $this->roles[ $role ]['capabilities'][ $cap ] );
if ( $this->use_db ) {
update_option( $this->role_key, $this->roles );
}
}