Command::delete_item( $args, $assoc_args )
Delete an existing item.
Contents
Source Source
File: libraries/lifterlms-cli/src/Commands/Restful/Command.php
public function delete_item( $args, $assoc_args ) { list( $status, $body ) = $this->do_request( 'DELETE', $this->get_filled_route( $args ), $assoc_args ); $id = isset( $body['previous'] ) ? $body['previous']['id'] : $body['id']; if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'porcelain' ) ) { \WP_CLI::line( $id ); } else { if ( empty( $assoc_args['force'] ) ) { \WP_CLI::success( "Trashed {$this->name} {$id}." ); } else { \WP_CLI::success( "Deleted {$this->name} {$id}." ); } } }
Expand full source code Collapse full source code View on GitHub