woocommerce_widget_settings_sanitize_option

Sanitize the value of a setting.

Description

apply_filters( 'woocommerce_widget_settings_sanitize_option', (unknown) $instance_key, (unknown) $new_instance, (unknown) $key, (unknown) $setting ); 

Parameters (4)

0. $instance_key (unknown)
The instance key.
1. $new_instance (unknown)
The new instance.
2. $key (unknown)
The key.
3. $setting (unknown)
The setting.

Usage

To run the hook, copy the example below.
  1. $instance_key = apply_filters( 'woocommerce_widget_settings_sanitize_option', $instance_key, $new_instance, $key, $setting ); 
  2.  
  3. if ( !empty( $instance_key ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_widget_settings_sanitize_option callback 
  2. function filter_woocommerce_widget_settings_sanitize_option( $instance_key, $new_instance, $key, $setting ) { 
  3. // make filter magic happen here... 
  4. return $instance_key
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_widget_settings_sanitize_option', 'filter_woocommerce_widget_settings_sanitize_option', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_widget_settings_sanitize_option', 'filter_woocommerce_widget_settings_sanitize_option', 10, 4 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/abstracts/abstract-wc-widget.php  
  1. $instance[ $key ] = apply_filters( 'woocommerce_widget_settings_sanitize_option', $instance[ $key ], $new_instance, $key, $setting );