[wp-trac] [WordPress Trac] #54192: `get_header_image_tag` doesn't add `srcset`/`sizes`
WordPress Trac
noreply at wordpress.org
Tue Oct 5 15:50:09 UTC 2021
#54192: `get_header_image_tag` doesn't add `srcset`/`sizes`
-------------------------------+------------------------------
Reporter: strarsis | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by strarsis):
Replying to [comment:6 hellofromTonya]:
> Hello @strarsis,
>
> Welcome back to Core's Trac! Thank you for the ticket.
>
> Replying to [comment:4 strarsis]:
> > Good point. The test case would meet the condition, as `$attr` doesn't
contain `srcset` and by default `srcset` is not added to `$attr`.
>
> Does this resolve the ticket and your test case? Or is it still not
generating the `srcset` and `size`?
>
> If the problem remains, check the `_wp_attachment_metadata` for the
attachment (see the
[https://github.com/WordPress/WordPress/blob/07139653b9f1b8b1cc88195b971e96597fbc8b10
/wp-includes/theme.php#L1226 code on about L1226]). Is it an array? If no,
then the generation is skipped.
>
> If it is an array and the generation is not happening, please share
step-by-step instructions including any code or attachments for
contributors to reproduce the problem. This type of information helps
contributors to investigate.
I prepared a minimal sample theme that demonstrates the issue:
https://github.com/strarsis/wp-test-theme-customheader-srcsetsizes
When a custom header image is specified, the default WordPress functions
output an `<img` element without the `srcset` and `sizes` attributes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54192#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list