sanitize_option_(option) filter-hookWP 2.3.0

Filters an option value following sanitization.


add_filter( 'sanitize_option_(option)', 'wp_kama_sanitize_option_filter', 10, 3 );

 * Function for `sanitize_option_(option)` filter-hook.
 * @param string $value          The sanitized option value.
 * @param string $option         The option name.
 * @param string $original_value The original value passed to the function.
 * @return string
function wp_kama_sanitize_option_filter( $value, $option, $original_value ){

	// filter...
	return $value;
The sanitized option value.
The option name.
The original value passed to the function.


Since 2.3.0 Introduced.
Since 4.3.0 Added the $original_value parameter.

Where the hook is called

wp-includes/formatting.php 5126
return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );

Where the hook is used in WordPress

wp-includes/option.php 2757
add_filter( "sanitize_option_{$option_name}", $args['sanitize_callback'] );
wp-includes/option.php 2847
remove_filter( "sanitize_option_{$option_name}", $deprecated );
wp-includes/option.php 2853
remove_filter( "sanitize_option_{$option_name}", $wp_registered_settings[ $option_name ]['sanitize_callback'] );