diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index e4cc8802f5..e0539b2681 100644
--- a/src/wp-includes/theme.php
+++ b/src/wp-includes/theme.php
@@ -1646,9 +1646,10 @@ function _custom_background_cb() {
$color = false;
}
+ $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
+
if ( ! $background && ! $color ) {
if ( is_customize_preview() ) {
- $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
printf( '', $type_attr );
}
return;
@@ -1701,8 +1702,6 @@ function _custom_background_cb() {
$attachment = " background-attachment: $attachment;";
$style .= $image . $position . $size . $repeat . $attachment;
-
- $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
}
?>