From 3f3593aa6c04506943fe743233f184384d99cdd5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 1 Apr 2019 16:18:52 +0000 Subject: [PATCH] Customize: Only add `custom-background` to `body_class()` if the current theme supports custom background. Props wido, swissspidy, ocean90, Mte90. Fixes #38168. Built from https://develop.svn.wordpress.org/trunk@45088 git-svn-id: http://core.svn.wordpress.org/trunk@44897 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 3 ++- wp-includes/theme.php | 4 +++- wp-includes/version.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index b817edec4f..3765e9873c 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -773,7 +773,8 @@ function get_body_class( $class = '' ) { $classes[] = 'no-customize-support'; } - if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) { + if ( current_theme_supports( 'custom-background' ) + && ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) ) { $classes[] = 'custom-background'; } diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 9a72126488..23907bc549 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -2730,7 +2730,9 @@ function _remove_theme_support( $feature ) { break; } $support = get_theme_support( 'custom-background' ); - remove_action( 'wp_head', $support[0]['wp-head-callback'] ); + if ( isset( $support[0]['wp-head-callback'] ) ) { + remove_action( 'wp_head', $support[0]['wp-head-callback'] ); + } remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) ); unset( $GLOBALS['custom_background'] ); break; diff --git a/wp-includes/version.php b/wp-includes/version.php index 063c299588..6d1b73ecef 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.2-beta1-45087'; +$wp_version = '5.2-beta1-45088'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.