-
Notifications
You must be signed in to change notification settings - Fork 139
Description
We should consider filtering the response to wp_get_attachment_image() to handle additional cases where a theme may be printing an image in ways other than the_content() and the_post_thumbnail().
Originally posted by @b1ink0 in #2178:
I was able to replicate this bug. It seems the issue is with the
webp_uploads_update_featured_image()function hooked topost_thumbnail_html, which only callswebp_uploads_img_tag_update_mime_type()and does not conditionally callwebp_uploads_wrap_image_in_picture()based onwebp_uploads_is_picture_element_enabled().And, right now we are using the
post_thumbnail_htmlfilter for the featured image, but we could use thewp_get_attachment_imagefilter as the bug reporter suggested. However, this filter would also include any image echoed using thewp_get_attachment_image()function, which is used for featured images and is also typically used by other plugins. So, I'm not sure whether the Modern Image Formats plugin should also handle those images.Also, while trying to replicate this bug, I noticed that (Using Twenty Twenty-One) Image Widgets or widget blocks containing the Image block and Gallery block don’t get their sources replaced with modern image formats because the
webp_uploads_wrap_image_in_picture()function only allows thethe_contentcontext, while widgets send thewidget_block_contentcontext.
See also #2179 (comment) from @adamsilverstein:
lets avoid altering other plugin output for now, the unexpected change could break things or cause conflicts.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status