customize_sanitize_js_(id) filter-hookWP 3.4.0

Filters a Customize setting value for use in JavaScript.

The dynamic portion of the hook name, $this->id, refers to the setting ID.

Usage

add_filter( 'customize_sanitize_js_(id)', 'wp_kama_customize_sanitize_js_id_filter', 10, 2 );

/**
 * Function for `customize_sanitize_js_(id)` filter-hook.
 * 
 * @param mixed                $value   The setting value.
 * @param WP_Customize_Setting $setting WP_Customize_Setting instance.
 *
 * @return mixed
 */
function wp_kama_customize_sanitize_js_id_filter( $value, $setting ){

	// filter...
	return $value;
}
$value(mixed)
The setting value.
$setting(WP_Customize_Setting)
WP_Customize_Setting instance.

Changelog

Since 3.4.0 Introduced.

Where the hook is called

WP_Customize_Setting::js_value()
customize_sanitize_js_(id)
wp-includes/class-wp-customize-setting.php 801
$value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this );

Where the hook is used in WordPress

wp-includes/class-wp-customize-setting.php 205
add_filter( "customize_sanitize_js_{$this->id}", $this->sanitize_js_callback, 10, 2 );