public function delete( $args, $assoc_args ) {
		$network  = Utils\get_flag_value( $assoc_args, 'network' ) && is_multisite();
		$reassign = Utils\get_flag_value( $assoc_args, 'reassign' );

		if ( $network && $reassign ) {
			WP_CLI::error( 'Reassigning content to a different user is not supported on multisite.' );
		}

		if ( ! $reassign ) {
			WP_CLI::confirm( '--reassign parameter not passed. All associated posts will be deleted. Proceed?', $assoc_args );
		}

		$users = $this->fetcher->get_many( $args );

		parent::_delete(
			$users,
			$assoc_args,
			function ( $user ) use ( $network, $reassign ) {
				$user_id = $user->ID;

				if ( $network ) {
					$result  = wpmu_delete_user( $user_id );
					$message = "Deleted user {$user_id}.";
				} else {
					$result  = wp_delete_user( $user_id, $reassign );
					$message = "Removed user {$user_id} from " . home_url() . '.';
				}

				if ( ! $result ) {
					return [ 'error', "Failed deleting user {$user_id}." ];
				}

				return [ 'success', $message ];
			}
		);
	}
public function delete( $args, $assoc_args ) {
		$network  = Utils\get_flag_value( $assoc_args, 'network' ) && is_multisite();
		$reassign = Utils\get_flag_value( $assoc_args, 'reassign' );

		if ( $network && $reassign ) {
			WP_CLI::error( 'Reassigning content to a different user is not supported on multisite.' );
		}

		if ( ! $reassign ) {
			WP_CLI::confirm( '--reassign parameter not passed. All associated posts will be deleted. Proceed?', $assoc_args );
		}

		$users = $this->fetcher->get_many( $args );

		parent::_delete(
			$users,
			$assoc_args,
			function ( $user ) use ( $network, $reassign ) {
				$user_id = $user->ID;

				if ( $network ) {
					$result  = wpmu_delete_user( $user_id );
					$message = "Deleted user {$user_id}.";
				} else {
					$result  = wp_delete_user( $user_id, $reassign );
					$message = "Removed user {$user_id} from " . home_url() . '.';
				}

				if ( ! $result ) {
					return [ 'error', "Failed deleting user {$user_id}." ];
				}

				return [ 'success', $message ];
			}
		);
	}
public function delete ( $ args , $ assoc_args ) { $ network = Utils \ get_flag_value ( $ assoc_args , 'network' ) && is_multisite ( ) ; $ reassign = Utils \ get_flag_value ( $ assoc_args , 'reassign' ) ; if ( $ network && $ reassign ) { WP_CLI :: error ( 'Reassigning content to a different user is not supported on multisite.' ) ; } if ( ! $ reassign ) { WP_CLI :: confirm ( '--reassign parameter not passed. All associated posts will be deleted. Proceed?' , $ assoc_args ) ; } $ users = $ this -> fetcher -> get_many ( $ args ) ; parent :: _delete ( $ users , $ assoc_args , function ( $ user ) use ( $ network , $ reassign ) { $ user_id = $ user -> ID ; if ( $ network ) { $ result = wpmu_delete_user ( $ user_id ) ; $ message = "Deleted user {$user_id}." ; } else { $ result = wp_delete_user ( $ user_id , $ reassign ) ; $ message = "Removed user {$user_id} from " . home_url ( ) . '.' ; } if ( ! $ result ) { return [ 'error' , "Failed deleting user {$user_id}." ] ; } return [ 'success' , $ message ] ; } ) ; }
Deletes one or more users from the current site.

On multisite, `wp user delete` only removes the user from the current
site. Include `--network` to also remove the user from the database, but
make sure to reassign their posts prior to deleting the user.

## OPTIONS

<user>...
: The user login, user email, or user ID of the user(s) to delete.

[--network]
: On multisite, delete the user from the entire network.

[--reassign=<user-id>]
: User ID to reassign the posts to.

[--yes]
: Answer yes to any confirmation prompts.

## EXAMPLES

# Delete user 123 and reassign posts to user 567
$ wp user delete 123 --reassign=567
Success: Removed user 123 from http://example.com

# Delete all contributors and reassign their posts to user 2
$ wp user delete $(wp user list --role=contributor --field=ID) --reassign=2
Success: Removed user 813 from http://example.com
Success: Removed user 578 from http://example.com
Deletes one or more users from the current site .