5.7 added loading="lazy" to iframes as well as images, and an embed without dimensions now reserves no space until it loads.
// disable for one context — a hero video, above the fold
add_filter( 'wp_lazy_loading_enabled',
function ( bool $default, string $tag, string $context ): bool {
if ( 'the_content' === $context && 'iframe' === $tag ) {
return false;
}
return $default;
}, 10, 3 );
The layout shift is the visible symptom: a video embed with no width and height attributes occupies no space until it loads and then pushes everything down, which is a Cumulative Layout Shift regression introduced by a performance feature. The right fix is dimensions on the embed rather than disabling lazy loading, and the filter is for the genuinely above-the-fold case where lazy loading delays the largest element on the page.