@@ -77,7 +77,7 @@ public function get( $args, $assoc_args ) {
7777 $ value = get_option ( $ key );
7878
7979 if ( false === $ value ) {
80- WP_CLI ::error ( "Could not get ' $ key' option. Does it exist? " );
80+ WP_CLI ::error ( "Could not get ' { $ key} ' option. Does it exist? " );
8181 }
8282
8383 WP_CLI ::print_value ( $ value , $ assoc_args );
@@ -132,9 +132,9 @@ public function add( $args, $assoc_args ) {
132132 }
133133
134134 if ( !add_option ( $ key , $ value , '' , $ autoload ) ) {
135- WP_CLI ::error ( "Could not add option ' $ key'. Does it already exist? " );
135+ WP_CLI ::error ( "Could not add option ' { $ key} '. Does it already exist? " );
136136 } else {
137- WP_CLI ::success ( "Added ' $ key' option. " );
137+ WP_CLI ::success ( "Added ' { $ key} ' option. " );
138138 }
139139 }
140140
@@ -420,12 +420,12 @@ public function update( $args, $assoc_args ) {
420420 $ old_value = sanitize_option ( $ key , get_option ( $ key ) );
421421
422422 if ( $ value === $ old_value && is_null ( $ autoload ) ) {
423- WP_CLI ::success ( "Value passed for ' $ key' option is unchanged. " );
423+ WP_CLI ::success ( "Value passed for ' { $ key} ' option is unchanged. " );
424424 } else {
425425 if ( update_option ( $ key , $ value , $ autoload ) ) {
426- WP_CLI ::success ( "Updated ' $ key' option. " );
426+ WP_CLI ::success ( "Updated ' { $ key} ' option. " );
427427 } else {
428- WP_CLI ::error ( "Could not update option ' $ key'. " );
428+ WP_CLI ::error ( "Could not update option ' { $ key} '. " );
429429 }
430430 }
431431 }
@@ -435,22 +435,28 @@ public function update( $args, $assoc_args ) {
435435 *
436436 * ## OPTIONS
437437 *
438- * <key>
438+ * <key>...
439439 * : Key for the option.
440440 *
441441 * ## EXAMPLES
442442 *
443443 * # Delete an option.
444444 * $ wp option delete my_option
445445 * Success: Deleted 'my_option' option.
446+ *
447+ * # Delete multiple options.
448+ * $ wp option delete option_one option_two option_three
449+ * Success: Deleted 'option_one' option.
450+ * Success: Deleted 'option_two' option.
451+ * Warning: Could not delete 'option_three' option. Does it exist?
446452 */
447453 public function delete ( $ args ) {
448- list ( $ key ) = $ args ;
449-
450- if ( ! delete_option ( $ key ) ) {
451- WP_CLI :: error ( " Could not delete ' $ key ' option. Does it exist? " );
452- } else {
453- WP_CLI :: success ( " Deleted ' $ key ' option. " );
454+ foreach ( $ args as $ arg ) {
455+ if ( ! delete_option ( $ arg ) ) {
456+ WP_CLI :: warning ( " Could not delete ' { $ arg } ' option. Does it exist? " );
457+ } else {
458+ WP_CLI :: success ( " Deleted ' { $ arg } ' option. " );
459+ }
454460 }
455461 }
456462
@@ -571,12 +577,12 @@ public function patch( $args, $assoc_args ) {
571577 $ patched_value = sanitize_option ( $ key , $ traverser ->value () );
572578
573579 if ( $ patched_value === $ old_value ) {
574- WP_CLI ::success ( "Value passed for ' $ key' option is unchanged. " );
580+ WP_CLI ::success ( "Value passed for ' { $ key} ' option is unchanged. " );
575581 } else {
576582 if ( update_option ( $ key , $ patched_value ) ) {
577- WP_CLI ::success ( "Updated ' $ key' option. " );
583+ WP_CLI ::success ( "Updated ' { $ key} ' option. " );
578584 } else {
579- WP_CLI ::error ( "Could not update option ' $ key'. " );
585+ WP_CLI ::error ( "Could not update option ' { $ key} '. " );
580586 }
581587 }
582588 }
0 commit comments