[wp-trac] [WordPress Trac] #53675: Omit lazy-loading attribute on first content image/iframe
WordPress Trac
noreply at wordpress.org
Fri Aug 13 02:45:06 UTC 2021
#53675: Omit lazy-loading attribute on first content image/iframe
--------------------------------------+--------------------------
Reporter: flixos90 | Owner: flixos90
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.9
Component: Media | Version: 5.5
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: performance
--------------------------------------+--------------------------
Comment (by flixos90):
@azaozz @westonruter Would you mind reviewing / testing the PR
https://github.com/WordPress/wordpress-develop/pull/1580?
Replying to [comment:6 westonruter]:
> What if someone is adding an image to the template outside of
`the_content()` and `the_post_thumbnail()`? They could also obtain an
image via `wp_get_attachment_image()` directly. Since that function
applies the `wp_lazy_loading_enabled` filter, perhaps the filter should
increment the counter instead of in the `post_thumbnail_html` and
`wp_img_tag_add_loading_attr` filters both?
This question may now be slightly off in relation to the core
implementation, however I wanna address the point of considering manually
placed images via `wp_get_attachment_image()`. It may be worth thinking
about this, but so far I'm thinking that the use-case of manually rendered
images within the content is too insignificant, plus themes may use this
to e.g. render small icon-like images etc., considering which here would
be rather counter-productive. Of course the post content could also
contain such tiny icon-like images as the first elements, but I think
that's a lot less likely.
I think relying on only featured images and in-content images is more
reliable here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53675#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list