WC_Settings_API::update_option()publicWC 3.4.0

Update a single option.

Method of the class: WC_Settings_API{}

Return

true|false. was anything saved?

Usage

$WC_Settings_API = new WC_Settings_API();
$WC_Settings_API->update_option( $key, $value );
$key(string) (required)
Option key.
$value(mixed)
Value to set.
Default: ''

Changelog

Since 3.4.0 Introduced.

WC_Settings_API::update_option() code WC 8.6.1

public function update_option( $key, $value = '' ) {
	if ( empty( $this->settings ) ) {
		$this->init_settings();
	}

	$this->settings[ $key ] = $value;

	return update_option( $this->get_option_key(), apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ), 'yes' );
}