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
This commit is contained in:
Sergey Biryukov 2019-04-01 16:18:52 +00:00
parent d8b8994336
commit 3f3593aa6c
3 changed files with 6 additions and 3 deletions

View File

@ -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';
}

View File

@ -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;

View File

@ -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.