Make WordPress Core


Ignore:
Timestamp:
11/03/2016 12:36:01 PM (8 years ago)
Author:
joemcgill
Message:

Themes: Improve reliability of URL used in get_header_image_tag().

get_header_image_tag() relies on the data returned by get_custom_header()
to build the attributes for the header <img> element. However,
get_custom_header() relies on data from the header_image_data theme
mod rather than the header_image theme mod that get_header_image() uses.
This can create inconsistencies when no header image is set, but a theme
supports a default header image.

This fixes the issue by making get_custom_image_tag() rely on the URL
returned by get_header_image() instead.

Props bradyvercher.
Fixes #38633.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r38991 r39121  
    10281028function get_header_image_tag( $attr = array() ) {
    10291029    $header = get_custom_header();
    1030 
    1031     if ( empty( $header->url ) ) {
     1030    $header->url = get_header_image();
     1031
     1032    if ( ! $header->url ) {
    10321033        return '';
    10331034    }
Note: See TracChangeset for help on using the changeset viewer.