[wp-trac] [WordPress Trac] #58773: Lazy load oEmbed iframes
WordPress Trac
noreply at wordpress.org
Tue Jul 18 20:53:20 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 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:
||origins with embed block||average_embed_block_count||
||48445||2.8925172876457887||
''I wonder if we should consider lowering the threshold for iframes back
to 1?'' (or 0 if iframe in viewport initial loads are rare?) Maybe we can
query httparchive to see how common the LCP element being an iframe is?
Here is the query I used to check for the oEmbed count:
{{{
WITH
WPEmbeds AS (
SELECT
url,
JSON_EXTRACT(payload, '$._cms.wordpress.has_embed_block') AS
has_embed_block,
CAST( JSON_EXTRACT(payload,
'$._cms.wordpress.embed_block_count.total') AS FLOAT64 ) AS
embed_block_count_total
FROM `httparchive.pages.2023_05_01_desktop`
),
CountedEmbeds AS (
SELECT
COUNT( DISTINCT url ) AS origins,
COUNTIF( has_embed_block="true" ) AS has_embed,
AVG( embed_block_count_total ) as average_embed_block_count
FROM
WPEmbeds
WHERE embed_block_count_total != 0
)
SELECT *
FROM CountedEmbeds
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58773#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list