WP_Customize_Setting::js_value(): mixed

In this article

Sanitize the setting’s value for use in JavaScript.

Return

mixed The requested escaped value.

Source

public function js_value() {

	/**
	 * Filters a Customize setting value for use in JavaScript.
	 *
	 * The dynamic portion of the hook name, `$this->id`, refers to the setting ID.
	 *
	 * @since 3.4.0
	 *
	 * @param mixed                $value   The setting value.
	 * @param WP_Customize_Setting $setting WP_Customize_Setting instance.
	 */
	$value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this );

	if ( is_string( $value ) ) {
		return html_entity_decode( $value, ENT_QUOTES, 'UTF-8' );
	}

	return $value;
}

Hooks

apply_filters( “customize_sanitize_js_{$this->id}”, mixed $value, WP_Customize_Setting $setting )

Filters a Customize setting value for use in JavaScript.

Changelog

VersionDescription
3.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.