public function remove_cap( $args, $assoc_args ) {
		$user = $this->fetcher->get_check( $args[0] );
		if ( $user ) {
			$cap = $args[1];
			if ( ! isset( $user->caps[ $cap ] ) ) {
				if ( isset( $user->allcaps[ $cap ] ) ) {
					WP_CLI::error( "The '{$cap}' cap for {$user->user_login} ({$user->ID}) is inherited from a role." );
				}
				WP_CLI::error( "No such '{$cap}' cap for {$user->user_login} ({$user->ID})." );
			}
			$user->remove_cap( $cap );

			WP_CLI::success( "Removed '{$cap}' cap for {$user->user_login} ({$user->ID})." );
		}
	}
public function remove_cap( $args, $assoc_args ) {
		$user = $this->fetcher->get_check( $args[0] );
		if ( $user ) {
			$cap = $args[1];
			if ( ! isset( $user->caps[ $cap ] ) ) {
				if ( isset( $user->allcaps[ $cap ] ) ) {
					WP_CLI::error( "The '{$cap}' cap for {$user->user_login} ({$user->ID}) is inherited from a role." );
				}
				WP_CLI::error( "No such '{$cap}' cap for {$user->user_login} ({$user->ID})." );
			}
			$user->remove_cap( $cap );

			WP_CLI::success( "Removed '{$cap}' cap for {$user->user_login} ({$user->ID})." );
		}
	}
public function remove_cap ( $ args , $ assoc_args ) { $ user = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; if ( $ user ) { $ cap = $ args [ 1 ] ; if ( ! isset ( $ user -> caps [ $ cap ] ) ) { if ( isset ( $ user -> allcaps [ $ cap ] ) ) { WP_CLI :: error ( "The '{$cap}' cap for {$user->user_login} ({$user->ID}) is inherited from a role." ) ; } WP_CLI :: error ( "No such '{$cap}' cap for {$user->user_login} ({$user->ID})." ) ; } $ user -> remove_cap ( $ cap ) ; WP_CLI :: success ( "Removed '{$cap}' cap for {$user->user_login} ({$user->ID})." ) ; } }
Removes a user's capability.

## OPTIONS

<user>
: User ID, user email, or user login.

<cap>
: The capability to be removed.

## EXAMPLES

$ wp user remove-cap 11 publish_newsletters
Success: Removed 'publish_newsletters' cap for supervisor (11).

$ wp user remove-cap 11 publish_posts
Error: The 'publish_posts' cap for supervisor (11) is inherited from a role.

$ wp user remove-cap 11 nonexistent_cap
Error: No such 'nonexistent_cap' cap for supervisor (11).

@subcommand remove-cap
Removes a user s capability .