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 $this WP_Customize_Setting instance.
*/
return apply_filters("customize_sanitize_{$this->id}", $value, $this);
}
/** * Returns the sanitized value for a given setting from the request's POST data. * * @since 3.4.0 * @since 4.1.1 Introduced the `$default` parameter. * @since 4.6.0 `$default` is now returned early when the setting post value is invalid. * @access public * * @see WP_REST_Server::dispatch() * @see WP_Rest_Request::sanitize_params() * @see WP_Rest_Request::has_valid_params() * * @param WP_Customize_Setting $setting A WP_Customize_Setting derived object. * @param mixed $default Value returned $setting has no post value (added in 4.2.0) * or the post value is invalid (added in 4.6.0). * @return string|mixed $post_value Sanitized value or the $default provided. */ public function post_value($setting, $default = null) { $post_values = $this->unsanitized_post_values(); if (!array_key_exists($setting->id, $post_values)) { return $default; } $value = $post_values[$setting->id]; $valid = $setting->validate($value); if (is_wp_error($valid)) { return $default; } $value = $setting->sanitize($value); if (is_null($value) || is_wp_error($value)) { return $default; } return $value; }