WP_Customize_Setting::sanitize() WordPress Method

The WP_Customize_Setting::sanitize() method is used to sanitize a setting's value before it is saved to the database. This is done by passing the value through a sanitization callback, which is a function that sanitizes the value.

WP_Customize_Setting::sanitize( string|array $value ) #

Sanitize an input.


Parameters

$value

(string|array)(Required)The value to sanitize.


Top ↑

Return

(string|array|null|WP_Error) Sanitized value, or null/WP_Error if invalid.


Top ↑

Source

File: wp-includes/class-wp-customize-setting.php

	public function sanitize( $value ) {

		/**
		 * Filters a Customize setting value in un-slashed form.
		 *
		 * @since 3.4.0
		 *
		 * @param mixed                $value   Value of the setting.
		 * @param WP_Customize_Setting $setting WP_Customize_Setting instance.
		 */
		return apply_filters( "customize_sanitize_{$this->id}", $value, $this );
	}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.