[wp-trac] [WordPress Trac] #59577: Images in block templates or patterns do not have loading optimization attributes

WordPress Trac noreply at wordpress.org
Mon Oct 9 19:12:48 UTC 2023


#59577: Images in block templates or patterns do not have loading optimization
attributes
--------------------------+--------------------------
 Reporter:  flixos90      |       Owner:  flixos90
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  6.5
Component:  Media         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  performance
--------------------------+--------------------------
Description changed by flixos90:

Old description:

> 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 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.

New description:

 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.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59577#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list