WC_Settings_Tracking::add_option_to_list()
Add a WooCommerce option name to our allowed options list and attach the update_option hook. Rather than inspecting every updated option and pattern matching for "woocommerce", just build a dynamic list for WooCommerce options that might get updated.
Method of the class: WC_Settings_Tracking{}
No Hooks.
Return
null
. Nothing.
Usage
$WC_Settings_Tracking = new WC_Settings_Tracking(); $WC_Settings_Tracking->add_option_to_list( $option );
- $option(array) (required)
- WooCommerce option (config) that might get updated.
WC_Settings_Tracking::add_option_to_list() WC Settings Tracking::add option to list code WC 7.7.0
public function add_option_to_list( $option ) { $this->allowed_options[] = $option['id']; // Delay attaching this action since it could get fired a lot. if ( false === has_action( 'update_option', array( $this, 'track_setting_change' ) ) ) { add_action( 'update_option', array( $this, 'track_setting_change' ), 10, 3 ); } }