Opened 10 years ago
Closed 10 years ago
#38633 closed defect (bug) (fixed)
get_header_image_tag() doesn't always return the correct image
| Reported by: | bradyvercher | Owned by: | joemcgill |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.7 |
| Component: | Themes | Version: | |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
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.
10 years ago
#3
@
10 years ago
- Keywords commit added
- Milestone Awaiting Review → 4.7
- Owner set to
- Status new → reviewing
Good catch, looks good to me.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.