From 2d07cd3fc516d04bf9a450ee97d9a079e12eec4a Mon Sep 17 00:00:00 2001 From: nacin Date: Mon, 11 Jun 2012 20:49:45 +0000 Subject: [PATCH] Theme Customizer: Remove background_image_thumb when saving settings. fixes #20871. This prevents the background_image and background_image_thumb settings from getting out of sync. In 3.5 we can consider using background-size on Appearance > Background, eliminating _thumb. git-svn-id: http://core.svn.wordpress.org/trunk@21053 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 4 ++++ wp-includes/class-wp-customize-setting.php | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index feb67d1fdc..cb2430054b 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -781,6 +781,10 @@ final class WP_Customize_Manager { 'theme_supports' => 'custom-background', ) ); + $this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array( + 'theme_supports' => 'custom-background', + ) ) ); + $this->add_control( new WP_Customize_Background_Image_Control( $this ) ); $this->add_setting( 'background_repeat', array( diff --git a/wp-includes/class-wp-customize-setting.php b/wp-includes/class-wp-customize-setting.php index b5873d83f1..c4cff0e29b 100644 --- a/wp-includes/class-wp-customize-setting.php +++ b/wp-includes/class-wp-customize-setting.php @@ -382,7 +382,7 @@ class WP_Customize_Filter_Setting extends WP_Customize_Setting { * * Results should be properly handled using another setting or callback. */ -class WP_Customize_Header_Image_Setting extends WP_Customize_Setting { +final class WP_Customize_Header_Image_Setting extends WP_Customize_Setting { public $id = 'header_image_data'; public function update( $value ) { @@ -398,4 +398,12 @@ class WP_Customize_Header_Image_Setting extends WP_Customize_Setting { else $custom_image_header->set_header_image( $value ); } -} \ No newline at end of file +} + +final class WP_Customize_Background_Image_Setting extends WP_Customize_Setting { + public $id = 'background_image_thumb'; + + public function update( $value ) { + remove_theme_mod( 'background_image_thumb' ); + } +}