[wp-trac] [WordPress Trac] #38633: get_header_image_tag() doesn't always return the correct image

WordPress Trac noreply at wordpress.org
Wed Nov 2 21:48:16 UTC 2016


#38633: get_header_image_tag() doesn't always return the correct image
--------------------------+-----------------------------
 Reporter:  bradyvercher  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Themes        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 `get_header_image_tag()` relies on `get_custom_header()` to retrieve the
 URL for the current header image, however `get_custom_header()` doesn't
 always return the correct URL.

 Most of the header image tags rely on `get_header_image()`, which uses the
 `header_image` theme mod. That theme mod should always contain the direct
 URL to an image, `remove-header`, `random-default-image`, or `random-
 uploaded-image`.

 `get_custom_header()` uses the `header_image_data` theme mod, which will
 be empty when the `header_image` theme mod has `remove-header`, `random-
 default-image`, or `random-uploaded-image`. When that's the case, it will
 return the URL for the default image instead.

 I'm not sure why `get_custom_header()` relies on a different theme mod or
 why the behavior is different. The URL it returns doesn't appear to be
 used anywhere else in core. At the very least, `get_header_image_tag()`
 should be updated to use `get_header_image()` for the image URL.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38633>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list