Make WordPress Core

Changeset 31130


Ignore:
Timestamp:
01/10/2015 09:07:54 PM (10 years ago)
Author:
wonderboymusic
Message:

get_header_image() can return false. In Custom_Image_Header->step_1(), check the value before setting the background-image portion of the style attribute. Setting the the URL to empty string will cause the current request to be set as the source of the background image.

See #30799.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/custom-header.php

    r31125 r31130  
    555555    } else {
    556556        $custom_header = get_custom_header();
    557         $header_image_style = 'background-image:url(' . esc_url( get_header_image() ) . ');';
     557        $header_image = get_header_image();
     558
     559        if ( $header_image ) {
     560            $header_image_style = 'background-image:url(' . esc_url( $header_image ) . ');';
     561        }  else {
     562            $header_image_style = '';
     563        }
     564
    558565        if ( $custom_header->width )
    559566            $header_image_style .= 'max-width:' . $custom_header->width . 'px;';
Note: See TracChangeset for help on using the changeset viewer.