diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 0e1ab13a5..15a350896 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -312,6 +312,7 @@ final class WP_Customize_Manager { $settings = array( 'values' => array(), 'channel' => esc_js( $_POST['customize_messenger_channel'] ), + 'backgroundImageHasDefault' => current_theme_supports( 'custom-background', 'default-image' ), ); foreach ( $this->settings as $id => $setting ) { diff --git a/wp-includes/js/customize-preview.dev.js b/wp-includes/js/customize-preview.dev.js index 28af66b8d..15ffc3c54 100644 --- a/wp-includes/js/customize-preview.dev.js +++ b/wp-includes/js/customize-preview.dev.js @@ -109,13 +109,14 @@ return; update = function() { - var css = ''; + var css = '', + hasDefault = api.settings.backgroundImageHasDefault; // The body will support custom backgrounds if either // the color or image are set. // // See get_body_class() in /wp-includes/post-template.php - body.toggleClass( 'custom-background', !! ( color() || image() ) ); + body.toggleClass( 'custom-background', !! ( color() || image() || hasDefault ) ); if ( color() ) css += 'background-color: ' + color() + ';'; @@ -125,6 +126,8 @@ css += 'background-position: top ' + position_x() + ';'; css += 'background-repeat: ' + repeat() + ';'; css += 'background-position: top ' + attachment() + ';'; + } else if ( hasDefault ) { + css += 'background-image: none;'; } // Refresh the stylesheet by removing and recreating it.