[wp-trac] [WordPress Trac] #56043: WordPress core Lazy Loading filters don't work on featured images
WordPress Trac
noreply at wordpress.org
Fri Sep 9 17:00:50 UTC 2022
#56043: WordPress core Lazy Loading filters don't work on featured images
------------------------------+--------------------------
Reporter: culturalistpress | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Media | Version: 6.0
Severity: normal | Resolution: duplicate
Keywords: | Focuses: performance
------------------------------+--------------------------
Comment (by gilbertococchi):
I was able to reproduce this issue on some WordPress Themes.
My understanding is that when Themes use the_post_thumbnail method then
the post-thumbnail-template.php class uses the
[wp_get_attachment_image](https://github.com/WordPress/WordPress/blob/1cd42e3cbe7890a891d7a37b6a7467188b3ef59e
/wp-includes/post-thumbnail-template.php#L202) method that is not handled
well by the
[wp_get_loading_attr_default](https://github.com/WordPress/WordPress/blob/b90c2adb7f65b610c84db80fa35b66cc036e1a66
/wp-includes/media.php#L5495-L5516) method.
I guess it may be feasible to increase the match on detecting Featured
images by handling this case by not applying loading=lazy on the first
iteration of the context wp_get_attachment_image.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56043#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list