Opened 7 years ago
Last modified 5 years ago
#43070 new defect (bug)
srcset attribute can be overridden but not prevented
Reported by: | desrosj | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Media | Keywords: | needs-patch |
Focuses: | Cc: |
Description
In wp_get_attachment_image()
, a srcset
attribute can be passed to the fourth parameter to override the attribute's contents. There is no way to prevent this attribute from showing, though. An empty srcset
attribute throws a validation error.
Change History (2)
Note: See
TracTickets for help on using
tickets.
Of note, the
srcset
can be removed with thewp_get_attachment_image_attributes
filter. But, that is not ideal.My use case: I am generating a
<picture>
element fallback<img />
that can't havesrcset
orsizes
attributes.