Command::delete_item( $args,  $assoc_args )

Delete an existing item.


Source Source

File: libraries/lifterlms-cli/src/Commands/Restful/Command.php

99
100
101
102
103
104
105
106
107
108
109
110
111
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}." );
        }
    }
}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.