sanitize_option_(option) хук-фильтрWP 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;
}
$value(строка)
The sanitized option value.
$option(строка)
The option name.
$original_value(строка)
The original value passed to the function.

Список изменений

С версии 2.3.0 Введена.
С версии 4.3.0 Added the $original_value parameter.

Где вызывается хук

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

Где используется хук в 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'] );