Opened 9 years ago
Closed 9 years ago
#38633 closed defect (bug) (fixed)
get_header_image_tag() doesn't always return the correct image
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.7 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Themes | Keywords: | has-patch commit |
| Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (6)
This ticket was mentioned in Slack in #core-themes by bradyvercher. View the logs.
9 years ago
#3
@
9 years ago
- Keywords commit added
- Milestone changed from Awaiting Review to 4.7
- Owner set to joemcgill
- Status changed from new to reviewing
Good catch, looks good to me.
Whoops, looks like I botched that patch number! 38663.diff uses
get_header_image()for the image URL inget_header_image_tag()to make sureremove-header,random-default-image, andrandom-uploaded-imagesettings are respected.