sanitize_option_(option) filter-hookWP 2.3.0

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 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;
}
$value(string)
The sanitized option value.
$option(string)
The option name.
$original_value(string)
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()
sanitize_option_(option)
wp-includes/formatting.php 5000
return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );

Where the hook is used in WordPress

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