pre_update_option
Filters an option before its value is (maybe) serialized and updated.
Usage
add_filter( 'pre_update_option', 'wp_kama_pre_update_option_filter', 10, 3 ); /** * Function for `pre_update_option` filter-hook. * * @param mixed $value The new, unserialized option value. * @param string $option Name of the option. * @param mixed $old_value The old option value. * * @return mixed */ function wp_kama_pre_update_option_filter( $value, $option, $old_value ){ // filter... return $value; }
- $value(mixed)
- The new, unserialized option value.
- $option(string)
- Name of the option.
- $old_value(mixed)
- The old option value.
Changelog
Since 3.9.0 | Introduced. |
Where the hook is called
pre_update_option
wp-includes/option.php 904
$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
Where the hook is used in WordPress
wp-includes/class-wp-customize-widgets.php 2132
add_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 );
wp-includes/class-wp-customize-widgets.php 2190
remove_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10 );