Developers · Gutenberg

YouTube Performance Embed block for WordPress

High-performance YouTube embed with poster + lazy iframe on click.

Get Blockenberg

Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.

Get Blockenberg

What it actually does

High-performance YouTube embed with poster + lazy iframe on click.

Inspector panels on this block: Video, Poster, Design, Play Button. Those titles come from index.js, not from a shared template.

Behavior controls: “YouTube URL or Video ID” (Paste a YouTube link (watch, short, embed, youtu.be) or an 11‑char ID); “Poster source” options: YouTube (maxresdefault), YouTube (hqdefault), Custom image; “Aspect ratio” options: Auto, 16:9, 4:3, 1:1; “Play Button — Style” options: YouTube, Circle, Rounded, Square.

Where to find it

Gutenberg inserter → Developers → search “YouTube Performance Embed” (block name `blockenberg/youtube-performance` in block.json). Style it in the sidebar after insert.

How to use YouTube Performance Embed block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “YouTube Performance Embed”, insert it. Category: Developers.
  3. Configure inspector controls that exist on this block. Open Video. Set “YouTube URL or Video ID”, “Show title overlay”, “Video — Title”, “Privacy mode (youtube-nocookie.com)”.
  4. Check the published page. The view script reads HTML data attributes: data-controls, data-loop, data-mute, data-privacy, data-rel, data-start, data-video-id. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
YouTube URL or Video IDText field in the inspector. Paste a YouTube link (watch, short, embed, youtu.be) or an 11‑char ID. Saved as `videoUrl`.
Show title overlayOn/off toggle in the inspector. Off by default. Saved as `showTitle`.
Video — TitleText field in the inspector. Saved as `title`.
Privacy mode (youtube-nocookie.com)On/off toggle in the inspector. On by default. Saved as `privacyMode`.
Start time (seconds)Numeric range control in the inspector. Range 0–600. block.json default: 0. Saved as `startTime`.
Show controlsOn/off toggle in the inspector. On by default. Saved as `controls`.
Related videos at endOn/off toggle in the inspector. Off by default. Saved as `rel`.
Mute on playOn/off toggle in the inspector. Off by default. Saved as `mute`.
LoopOn/off toggle in the inspector. Off by default. Saved as `loop`.
Poster sourceSelect control; the chosen value is saved on the block. Options: YouTube (maxresdefault); YouTube (hqdefault); Custom image. block.json default: youtube-max. Saved as `posterSource`.
Aspect ratioSelect control; the chosen value is saved on the block. Options: Auto; 16:9; 4:3; 1:1. block.json default: 4/3. Saved as `aspect`.
Minimum height (px)Numeric range control in the inspector. Range 120–900. block.json default: 350. Saved as `minHeight`.
Border radiusNumeric range control in the inspector. Range 0–40. block.json default: 12. Saved as `borderRadius`.
Design — ShadowOn/off toggle in the inspector. Off by default. Saved as `shadow`.
Play Button — StyleSelect control; the chosen value is saved on the block. Options: YouTube; Circle; Rounded; Square. block.json default: youtube. Saved as `playStyle`.
Play Button — SizeNumeric range control in the inspector. Range 36–120. block.json default: 50. Saved as `playSize`.
Hover scaleNumeric range control in the inspector. Range 1–1.2. block.json default: 1.05. Saved as `playHoverScale`.

What the front-end script actually does

When this is the right block

Notes from the implementation

viewScript: this folder’s frontend.js is enqueued on the front end for this block.

FAQ

How do I add the YouTube Performance Embed block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “YouTube Performance Embed”. It sits under Developers. After insert, open Video and set “YouTube URL or Video ID”, “Show title overlay”, “Video — Title”, “Privacy mode (youtube-nocookie.com)”.

What makes YouTube Performance Embed different from other Blockenberg blocks?

High-performance YouTube embed with poster + lazy iframe on click. Inspector labels on this block include “YouTube URL or Video ID”, “Show title overlay”, “Video — Title”, “Privacy mode (youtube-nocookie.com)”.

Is the YouTube Performance Embed Gutenberg block free?

Yes. YouTube Performance Embed ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.

Can I style YouTube Performance Embed to match my theme?

Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Video, Poster, Design, Play Button).

Related developers blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert YouTube Performance Embed from the Gutenberg inserter.

Get Blockenberg