Embed Optimizer
This plugin’s purpose is to optimize the performance of embeds in WordPress, such as Tweets, YouTube videos, TikToks, and others. The current optimizations include: Lazy loading embeds just before they come into view. Adding dns-prefetch links for embeds in the initial viewport. Reserving space for embeds that resize to reduce layout shifting. Lazy loading embeds improves performance because embeds are generally very resource-intensive, so lazy loading them ensures that they don’t compete with resources when the page is loading. Lazy loading of IFRAME-based embeds is handled simply by adding the loading=lazy attribute. Lazy loading embeds that include SCRIPT tags is handled by using an Intersection Observer to watch for when the embed’s FIGURE container is going to enter the viewport, and then it dynamically inserts the SCRIPT tag. This plugin also recommends that you install and activate the Optimization Detective plugin, which unlocks several optimizations beyond just lazy loading. Without Optimization Detective, lazy loading can actually degrade performance when an embed is positioned in the initial viewport. This is because lazy loading such viewport-initial elements can degrade LCP since rendering is delayed by the logic to determine whether the element is visible. This is why WordPress Core tries its best to avoid lazy loading IMG tags which appear in the initial viewport, although the server-side heuristics aren’t perfect. This is where Optimization Detective comes in since it detects whether an embed appears in any breakpoint-specific viewports, like mobile, tablet, and desktop. (See also the Image Prioritizer plugin which extends Optimization Detective to ensure lazy loading is correctly applied based on whether an IMG is in the initial viewport.) When Optimization Detective is active, it will start keeping track of which embeds appear in the initial viewport based on actual visits to your site. With this information in hand, Embed Optimizer will then avoid lazy loading embeds which appear in the initial viewport. Furthermore, for such above-the-fold embeds Embed Optimizer will also add dns-prefetch links for resources known to be used by those embeds. For example, if a YouTube embed appears in the initial viewport, Embed Optimizer with Optimization Detective will omit loading=lazy while also adding a dns-prefetch link for https://i.ytimg.com which is the domain from which YouTube video poster images are served. Such links cause the initial-viewport embeds to load even faster. The other major feature in Embed Optimizer enabled by Optimization Detective is the reduction of layout shifts caused by embeds that resize when they load. This is seen commonly in WordPress post embeds or Tweet embeds. Embed Optimizer keeps track of the resized heights of these embeds. With these resized heights stored, Embed Optimizer sets the appropriate height on the container FIGURE element as the viewport-specific min-height so that when the embed loads it does not cause a layout shift. Since Optimization Detective relies on page visits to learn how the page is laid out, you’ll need to wait until you have visits from a mobile and desktop device to start seeing optimizations applied. Also, note that Optimization Detective does not apply optimizations by default for logged-in admin users. Please note that the optimizations are intended to apply to Embed blocks. So if you do not see optimizations applied, make sure that your embeds are not inside a Classic Block. Your site must have the REST API accessible to unauthenticated frontend visitors since this is how metrics are collected about how a page should be optimized. There are currently no settings and no user interface for this plugin since it is designed to work without any configuration.
Simple Like Page – Fast & Privacy-Friendly Page Embeds
Embedding social Page content often slows down WordPress sites and loads third-party scripts before visitors interact. Simple Like Page helps you embed Meta™ Page content without hurting performance, by delaying script loading until interaction or visibility. This reduces unnecessary requests, improves Core Web Vitals, and gives you control over when external scripts load. This plugin is not affiliated with, endorsed by, or sponsored by Meta Platforms, Inc. All trademarks belong to their respective owners. Key Features Privacy-First Loading Delays Facebook script loading until user interaction Optional lazy loading when the embed enters the viewport Helps reduce third-party requests on initial page load Performance Focused Lightweight HTML placeholder before activation No render-blocking Facebook SDK on initial page load Multiple Integration Options Gutenberg block Shortcode Classic widget Theme template tag Extensible Hooks and filters for add-ons Architecture designed for future consent-based extensions How It Works Renders a placeholder instead of the Facebook embed Loads Facebook scripts only after user interaction (or when in view, if enabled) Renders the Page Plugin once scripts are available This approach is designed to improve performance and reduce unnecessary third-party requests. Usage You can add the Facebook Page Plugin in four different ways. 1. Gutenberg Block (Recommended) Edit any post or page Click Add Block (+) Search for Simple Like Page Insert the block Paste your Facebook Page URL Adjust layout and privacy options in the block sidebar 2. Shortcode Use the shortcode inside any post or page: sfp-page-plugin Shortcode parameters: url width height hide_cover show_facepile small_header timeline events messages locale click_to_load lazy_load placeholder_text placeholder_bg_color placeholder_text_color Example: [sfp-page-plugin url="https://www.facebook.com/WordPress" width="320" timeline="true"] 3. Widget Go to Appearance -> Widgets Add SFP – Like Page Plugin Enter your Facebook Page URL Configure display options Save 4. Template Tag (Advanced) For theme developers: 'https://www.facebook.com/WordPress/', 'width' => '300', 'timeline' => true, 'locale' => 'en_US' ); sfp_page_plugin( $args ); } ?> Performance & Privacy By default, the plugin delays Facebook loading until interaction. If you enable lazy loading, scripts are loaded when the embed is in view. Facebook may set cookies or process data once the embed loads. You are responsible for updating your privacy policy as needed. Settings The plugin includes a Performance & Privacy section where you can control: Click-to-load (default off) Lazy loading (default on) Placeholder text Placeholder colors You can also set a default Facebook Page URL and locale in the settings screen. Compatibility Works with modern WordPress themes Compatible with caching and performance plugins Supports Gutenberg and Classic Editor Support Found a bug or have a feature request? Please use the Support tab on WordPress.org.