Skip to content

Commit a547916

Browse files
committed
Add validation for status argument
1 parent c8bfad0 commit a547916

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

includes/CLI.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ public static function orders( $args, $assoc_args ) {
8181
$amount = 100;
8282
}
8383

84+
if ( ! empty( $assoc_args['status'] ) ) {
85+
$status = $assoc_args['status'];
86+
if ( ! wc_is_order_status( 'wc-' . $status ) ) {
87+
WP_CLI::log( "The argument \"$status\" is not a valid order status." );
88+
return;
89+
}
90+
}
91+
8492
if ( $amount > 0 ) {
8593
$progress = \WP_CLI\Utils\make_progress_bar( 'Generating orders', $amount );
8694
for ( $i = 1; $i <= $amount; $i++ ) {

0 commit comments

Comments
 (0)