Understanding embeds in WordPress

I am researching lazy loading of embeds on WordPress sites. In particular, I want to look into the “Embed block” WordPress places into a post when a user pastes in a URL from a supported oEmbed provider. Currently supported oEmbeds in the block editor are listed here.

My local testing indicates that iframes are not consistently lazy-loaded on WordPress sites, even though WordPress already auto-applies the loading=lazy attribute to iframes in the content. As a result, all of the assets required for these embeds are loaded when the page is loaded, even when they aren’t in the viewport.

I’m still digging into if/how we can improve these embeds, which might be at the source - the oEmbed providers themselves. In the meantime, I’d like to understand the size of the problem by examining the embeds found on WordPress sites.

Some questions:

  • How many WordPress sites use an embed block (detection added)? Leaving off non-block embeds which will be harder to detect.
  • How many embeds are used, broken down by provider (detection proposed)?
  • How many of these oEmbeds are the LCP element?
  • How many of these embeds have an iframe that uses loading=”lazy”?

Appreciate any tips on answering the last two questions!

1 Like