WP_User::remove_cap()publicWP 2.0.0

Removes capability from user.

Метод класса: WP_User{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WP_User = new WP_User();
$WP_User->remove_cap( $cap );
$cap(строка) (обязательный)
Capability name.

Список изменений

С версии 2.0.0 Введена.

Код WP_User::remove_cap() WP 6.4.3

public function remove_cap( $cap ) {
	if ( ! isset( $this->caps[ $cap ] ) ) {
		return;
	}
	unset( $this->caps[ $cap ] );
	update_user_meta( $this->ID, $this->cap_key, $this->caps );
	$this->get_role_caps();
	$this->update_user_level_from_caps();
}