From 28795e8dc233c7e3cc68717dd3f5e6568802ca3f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 9 Oct 2016 20:08:32 +0000 Subject: [PATCH] Customize: Ensure `customize_validate_{$setting->id}` filters apply on input post values for `WP_Customize_Setting` subclasses that neglect to apply the filter themselves. Fixes #37638. Built from https://develop.svn.wordpress.org/trunk@38765 git-svn-id: http://core.svn.wordpress.org/trunk@38708 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 7 +++++++ wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index bb892b564e..23e319167e 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -1003,6 +1003,13 @@ final class WP_Customize_Manager { continue; } $validity = $setting->validate( $unsanitized_value ); + if ( ! is_wp_error( $validity ) ) { + /** This filter is documented in wp-includes/class-wp-customize-setting.php */ + $late_validity = apply_filters( "customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting ); + if ( ! empty( $late_validity->errors ) ) { + $validity = $late_validity; + } + } if ( ! is_wp_error( $validity ) ) { $value = $setting->sanitize( $unsanitized_value ); if ( is_null( $value ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 2e35c2bf2c..3a45604f45 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38764'; +$wp_version = '4.7-alpha-38765'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.