Opened 2 months ago
Last modified 7 weeks ago
#59577 assigned defect (bug)
Images in block templates or patterns do not have loading optimization attributes
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | needs-patch |
Focuses: | performance | Cc: |
Description (last modified by )
This ticket is created as a break out from #59464: While that ticket was also initially pointing out the lack of loading optimization attributes in TT4, it has been primarily focused on the lack of the dimension attributes width
and height
from images that are hard-coded in the theme (e.g. in a core/image
block within the theme's block templates, template parts, or patterns).
As noted in https://core.trac.wordpress.org/ticket/59464#comment:16 however, there is another arguably more severe problem: Even if that bug was fixed for TT4, most of those images still wouldn't receive the loading optimization attributes. That is because TT4 includes most of its images directly in block templates, or in patterns, outside of template parts, post content, or widget content.
Currently, any images that aren't covered by more specific contexts than template
(which is for the overall block template) are not handled at all by wp_filter_content_tags()
, impacting TT4 and likely several other block themes. This ticket is focused on that problem, trying to identify a solution to also consider images in the overall block template, while avoiding duplicate processing of images that were already processed with a more specific context.