Iframe Block – Easy Embed Block for YouTube, Vimeo & More

Description

Iframe Block adds one dedicated block for every external embed that has no first-party core block: videos, maps, audio players, dashboards, booking tools, donation widgets, LMS players, calendars and forms.

Paste a link, pick a ratio, publish. The block converts YouTube and Vimeo links to their proper player URLs automatically, so a plain youtu.be/… share link or a Vimeo unlisted link just works.

What you get

  • Responsive aspect ratios — 16:9, 4:3, 1:1, 21:9 and 9:16 reserve the space before the embed loads, so nothing jumps around while the page renders. Fixed pixel heights are still available for maps, forms and dashboards.
  • Smart URL handling — YouTube watch, share, Shorts, live and embed links, playlists and start times (?t=1m30s) are normalised. Vimeo watch, channel, group and unlisted (hash) links become proper player URLs.
  • Privacy mode — one toggle switches YouTube to youtube-nocookie.com, so no viewing cookies are set until playback starts.
  • Lazy-loading that behaves — each block gets its own load margin, embeds load once and never reload on scroll, and the small helper script is only enqueued on pages that actually contain a lazy embed. Optional “watch for dynamic content” also covers embeds inserted later by sliders, tabs or infinite scroll.
  • SEO and accessibility markup — semantic figure / figcaption, a required accessible title on every iframe, and a noscript fallback link to the embed for crawlers and script-less visitors.
  • Safe by default — only http(s) URLs are accepted, inline styles are filtered for known XSS vectors, sandbox tokens are validated, and referrerpolicy="strict-origin-when-cross-origin" is always set.

Pair it with your SEO plugin (Yoast, Rank Math, SEOPress, AIOSEO, The SEO Framework) for meta tags, schema and sitemaps.

Blocks

This plugin provides 1 block.

  • Iframe & embed (YouTube, Vimeo, maps) Embed responsive HTTPS iframes for YouTube, Vimeo, Google Maps, audio, booking tools, and more. Add an optional visible caption and accessible title for SEO and screen readers.

Installation

  1. Install and activate the plugin from Plugins > Add New, or upload the ZIP.
  2. Edit a post or page in the block editor.
  3. Insert Iframe & embed (YouTube, Vimeo, maps), or search for “iframe”.
  4. Paste a URL and press Embed.
  5. Optional: set an aspect ratio, an accessible Title, a visible Caption, and enable lazy-loading under Performance.

FAQ

Why does the editor show a thumbnail instead of the player?

YouTube and Vimeo refuse to play inside the admin screen (YouTube reports “Error 153”), so the block shows the official poster image while editing. The real player renders on the published page.

Does this work with unlisted or private videos?

Unlisted Vimeo links that carry a hash (vimeo.com/123456789/abc123) are supported — the hash is passed to the player. Private videos that require a login cannot be embedded by any plugin.

Will lazy-loading break my slider or tab content?

No. Enable Watch for dynamic content and embeds inserted after page load are picked up too. Embeds are loaded once and are never reloaded when they scroll back into view.

Can I embed any website?

Only sites that allow embedding. Many services (banks, Google Search, some social networks) send X-Frame-Options or a frame-ancestors policy that blocks all iframes — that is enforced by the browser and cannot be overridden by a plugin.

Is the caption required?

No, but it helps: it is output as a real <figcaption>, giving readers and search engines context for the embed.

Will updating change my existing blocks?

No. Markup shipped by earlier versions is kept as a registered deprecation, so old embeds keep validating and are migrated silently the next time you edit them.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Iframe Block – Easy Embed Block for YouTube, Vimeo & More” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.1.0

Fixed

  • Lazy-loaded embeds with “live observe” enabled reloaded themselves every time they scrolled back into view. Embeds now load exactly once.
  • The load margin is applied per block again. Previously the largest value on the page was applied to every lazy embed, with a hidden 50px minimum.
  • “Live observe” now does what it promises: it detects embeds inserted after page load (sliders, tabs, AJAX) instead of only re-observing existing ones. Renamed to Watch for dynamic content.
  • URLs from other hosts that merely looked like YouTube links (any /embed/<11 characters> path) were rewritten to YouTube. Detection is now host-based.
  • Vimeo channel, group, player and unlisted (hash) links are recognised instead of being embedded as a page that refuses framing.
  • YouTube start times (?t=90, ?t=1m30s) and playlists are preserved in the embed URL.
  • The block icon no longer renders as an 800px hard-coded black square; it inherits the editor colour.
  • Editor strings are now translatable at runtime (wp_set_script_translations was missing).
  • The render_block filter no longer type-hints its arguments, which could fatal when another plugin returned null, and the lazy helper script is only enqueued for genuinely lazy embeds.
  • Typing an unusable URL now shows an inline error instead of silently rendering an empty frame.

Added

  • Responsive aspect ratios: 16:9, 4:3, 1:1, 21:9, 9:16.
  • Privacy mode for YouTube (youtube-nocookie.com).
  • Replace URL toolbar button, provider badge, and inline validation in the editor.
  • Block deprecation support, so future markup changes cannot invalidate existing posts.
  • Skeleton placeholder while a lazy embed waits for the viewport (respects prefers-reduced-motion).

Changed

  • Requires WordPress 6.5 or newer (block API v3).
  • The front-end helper script is loaded with defer.
  • Build tooling updated to @wordpress/scripts 34 and ESLint 9 flat config.
  • allow now includes fullscreen; data-live is only emitted on lazy embeds.

1.0.4

  • Compatibility: tested with WordPress 7.1 (block API v3, no deprecated APIs in use).
  • Compatibility: verified alongside Elementor 4.1 and WooCommerce 10.8 — the block renders unchanged inside Elementor’s block widget and on WooCommerce templates.
  • Housekeeping: plugin header now declares Tested up to; block and package versions synced to the plugin version.
  • No functional or markup changes.

1.0.3

  • Updated @wordpress/scripts and development dependencies; rebuilt block editor assets.

1.0.2

  • SEO improvements: optional caption as <figcaption>, <figure> wrapper, <noscript> HTTPS link fallback, expanded block keywords and readme tags for discoverability.
  • WordPress 7.0 readiness; PHP 7.4 minimum; hardened URLs; fixed YouTube detection; native lazy-load + IntersectionObserver; scoped front-end script; i18n bootstrap.

1.0.1

  • Compatibility updates for WordPress 6.8
  • Minor improvements and optimizations

1.0.0

  • Initial release with core features