WC_Settings_API::update_option()
Update a single option.
Method of the class: WC_Settings_API{}
Hooks from the method
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() 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' ); }