diff --git a/src/wp-admin/includes/class-custom-background.php b/src/wp-admin/includes/class-custom-background.php index d8500d8570405..8027c6a2ce95e 100644 --- a/src/wp-admin/includes/class-custom-background.php +++ b/src/wp-admin/includes/class-custom-background.php @@ -288,7 +288,7 @@ public function admin_page() { $background_styles = ''; $bgcolor = get_background_color(); if ( $bgcolor ) { - $background_styles .= 'background-color: #' . $bgcolor . ';'; + $background_styles .= 'background-color: ' . maybe_hash_hex_color( $bgcolor ) . ';'; } $background_image_thumb = get_background_image(); diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 1a9b2479ad7e2..5b6824b4a1073 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -1893,7 +1893,7 @@ function _custom_background_cb() { return; } - $style = $color ? "background-color: #$color;" : ''; + $style = $color ? 'background-color: ' . maybe_hash_hex_color( $color ) . ';' : ''; if ( $background ) { $image = ' background-image: url("' . sanitize_url( $background ) . '");';