[wp-trac] [WordPress Trac] #58773: Lazy load oEmbed iframes
WordPress Trac
noreply at wordpress.org
Tue Jul 18 21:17:00 UTC 2023
#58773: Lazy load oEmbed iframes
-------------------------------------+-------------------------------------
Reporter: adamsilverstein | Owner: adamsilverstein
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.4
Component: Embeds | Version:
Severity: normal | Resolution:
Keywords: needs-testing has-patch | Focuses: performance,
has-unit-tests | sustainability
-------------------------------------+-------------------------------------
Comment (by joemcgill):
Replying to [comment:12 adamsilverstein]:
> After discussing this further with @flixos90 I re-tested and it turns
out the regular content filters **do** work correctly for oEmbed iframes.
The issue with my tests is that I was only testing with a single or two
oEmbeds and `wp_omit_loading_attr_threshold` is now set at 3. Oof!
>
> Querying httparchive (query below), I found that for WordPress sites
that use an oEmbed block, the average number of oEmbeds is below 3
One consideration here (if I'm not mistaken) is that the
`wp_omit_loading_attr_threshold()` is cumulative — meaning it will be the
sum of all images AND iframes found in the page, not just the number of
embeds. This means that WordPress will begin to apply lazy loading to the
fourth object on the page regardless. Perhaps we should treat the
threshold for iframes differently from images, but it would good to run
some numbers on the number of embeds that end up being counted as a part
of the LCP value to see if it would make a significant difference.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58773#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list