Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make…
About Embed Optimizer
This plugin optimizes the performance of embeds in WordPress by lazy loading them, adding preconnect links for resources used by embeds, and reducing layout shifts caused by resizing embeds. It is recommended to install and activate the Optimization Detective plugin alongside Embed Optimizer for additional optimizations. There are no settings or user interface for this plugin as it is designed to work without any configuration.Frequently asked questions
What is the purpose of the Embed Optimizer plugin?
The plugin optimizes the performance of embeds in WordPress, such as Tweets, YouTube videos, and TikToks. It achieves this by lazy-loading iframes and scripts, adding preconnect links for initial viewport embeds, and reserving space to reduce layout shifting.
How does lazy loading improve performance?
Lazy loading improves performance by ensuring resource-intensive embeds don't compete with other resources during page loading. IFRAME-based embeds are lazy-loaded using the loading=lazy attribute, while script-based embeds use an Intersection Observer to dynamically insert script tags when they enter the viewport.
Why is the Optimization Detective plugin recommended?
The Optimization Detective plugin is recommended because it unlocks additional optimizations beyond just lazy loading. Without it, lazy loading can degrade performance for embeds in the initial viewport by delaying rendering, impacting LCP. Optimization Detective detects if an embed appears in breakpoint-specific viewports (mobile, tablet, desktop) to prevent this.
Changelog
1.0.0-beta1
Enhancements
- Bump version to 1.0.0-beta1 to indicate graduation from being experimental. See 1846.
- Use CSS range syntax in media queries. (1833)
0.4.1
Bug Fixes
- Remove requirement for both mobile and desktop URL metrics to be collected for
preconnectlinks to be added. (1764)
0.4.0
Enhancements
- Incorporate media queries into preconnect links to account for whether embeds are in viewport. (1654)
- Serve unminified scripts when
SCRIPT_DEBUGis enabled. (1643)
0.3.0
Enhancements
- Leverage URL Metrics to reserve space for embeds to reduce CLS. (1373)
- Avoid lazy-loading images and embeds unless there are URL Metrics for both mobile and desktop. (1604)
0.2.0
Enhancements
- Facilitate embedding of Embed Optimizer. (1337)
- Leverage Optimization Detective to optimize embeds in Embed Optimizer. (1302)
0.1.2
Enhancements
- Improve overall code quality with stricter static analysis checks. (775)
- Bump minimum PHP requirement to 7.2. (1130)
Bug Fixes
- Hide post embed iframes with visibility:hidden instead of clipping. (1192)
0.1.1
0.1.0
- Initial release.
