WordPress.org

Make WordPress Core

Ticket #22030: 22030.1.2.diff

File 22030.1.2.diff, 815 bytes (added by obenland, 9 months ago)
  • wp-admin/custom-background.php

     
    169169                if ( isset($_POST['background-color']) ) { 
    170170                        check_admin_referer('custom-background'); 
    171171                        $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); 
    172                         if ( strlen($color) == 6 || strlen($color) == 3 ) 
    173                                 set_theme_mod('background_color', $color); 
     172                        if ( ( strlen( $color ) == 6 || strlen( $color ) == 3 ) && get_theme_support( 'custom-background', 'default-color' ) != $color ) 
     173                                set_theme_mod( 'background_color', $color ); 
    174174                        else 
    175                                 set_theme_mod('background_color', ''); 
     175                                remove_theme_mod( 'background_color' ); 
    176176                } 
    177177 
    178178                $this->updated = true;