WordPress at a glance

WP_Roles::remove_cap() WP 1.0

Remove capability from role.

No Hooks.

Return

Null. Nothing.

Usage

$WP_Roles = new WP_Roles();
$var = $WP_Roles->remove_cap( $role, $cap );
$role(string) (required)
Role name.
$cap(string) (required)
Capability name.

Changelog

Since 2.0.0 Introduced.

Code of WP Roles::remove cap: wp-includes/class-wp-roles.php WP 5.2.2

<?php
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 );
	}
}
No comments
    Hello, !     Log In . Register