sanitize_option_(option)
Filters an option value following sanitization.
Usage
add_filter( 'sanitize_option_(option)', 'wp_kama_sanitize_option_filter', 10, 3 ); /** * Function for `sanitize_option_(option)` filter-hook. * * @param mixed $value The sanitized option value. * @param string $option The option name. * @param mixed $original_value The original value passed to the function. * * @return mixed */ function wp_kama_sanitize_option_filter( $value, $option, $original_value ){ // filter... return $value; }
- $value(mixed)
- The sanitized option value.
- $option(string)
- The option name.
- $original_value(mixed)
- The original value passed to the function.
Changelog
Since 2.3.0 | Introduced. |
Since 4.3.0 | Added the $original_value parameter. |
Where the hook is called
sanitize_option_(option)
wp-includes/formatting.php 5115
return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );
Where the hook is used in WordPress
wp-includes/option.php 2983
add_filter( "sanitize_option_{$option_name}", $args['sanitize_callback'] );
wp-includes/option.php 3073
remove_filter( "sanitize_option_{$option_name}", $deprecated );
wp-includes/option.php 3079
remove_filter( "sanitize_option_{$option_name}", $wp_registered_settings[ $option_name ]['sanitize_callback'] );