public function update( $args, $assoc_args ) {

		list( $widget_id ) = $args;
		if ( ! $this->validate_sidebar_widget( $widget_id ) ) {
			WP_CLI::error( "Widget doesn't exist." );
		}

		if ( empty( $assoc_args ) ) {
			WP_CLI::error( 'No options specified to update.' );
		}

		list( $name, $option_index ) = $this->get_widget_data( $widget_id );

		$widget_options                  = $this->get_widget_options( $name );
		$clean_options                   = $this->sanitize_widget_options( $name, $assoc_args, $widget_options[ $option_index ] );
		$widget_options[ $option_index ] = array_merge( (array) $widget_options[ $option_index ], $clean_options );
		$this->update_widget_options( $name, $widget_options );

		WP_CLI::success( 'Widget updated.' );

	}
public function update( $args, $assoc_args ) {

		list( $widget_id ) = $args;
		if ( ! $this->validate_sidebar_widget( $widget_id ) ) {
			WP_CLI::error( "Widget doesn't exist." );
		}

		if ( empty( $assoc_args ) ) {
			WP_CLI::error( 'No options specified to update.' );
		}

		list( $name, $option_index ) = $this->get_widget_data( $widget_id );

		$widget_options                  = $this->get_widget_options( $name );
		$clean_options                   = $this->sanitize_widget_options( $name, $assoc_args, $widget_options[ $option_index ] );
		$widget_options[ $option_index ] = array_merge( (array) $widget_options[ $option_index ], $clean_options );
		$this->update_widget_options( $name, $widget_options );

		WP_CLI::success( 'Widget updated.' );

	}
public function update ( $ args , $ assoc_args ) { list ( $ widget_id ) = $ args ; if ( ! $ this -> validate_sidebar_widget ( $ widget_id ) ) { WP_CLI :: error ( "Widget doesn't exist." ) ; } if ( empty ( $ assoc_args ) ) { WP_CLI :: error ( 'No options specified to update.' ) ; } list ( $ name , $ option_index ) = $ this -> get_widget_data ( $ widget_id ) ; $ widget_options = $ this -> get_widget_options ( $ name ) ; $ clean_options = $ this -> sanitize_widget_options ( $ name , $ assoc_args , $ widget_options [ $ option_index ] ) ; $ widget_options [ $ option_index ] = array_merge ( ( array ) $ widget_options [ $ option_index ] , $ clean_options ) ; $ this -> update_widget_options ( $ name , $ widget_options ) ; WP_CLI :: success ( 'Widget updated.' ) ; }
Updates options for an existing widget.

## OPTIONS

<widget-id>
: Unique ID for the widget

[--<field>=<value>]
: Field to update, with its new value

## EXAMPLES

# Change calendar-1 widget title to "Our Calendar"
$ wp widget update calendar-1 --title="Our Calendar"
Success: Widget updated.

@subcommand update
Updates options for an existing widget .