GCBGutenberg
Control Blocks
Buy

Field type

oembed

URL input with a live embed preview underneath. Stores just the URL — embedding happens at render time via WP''s oEmbed handling or <wp-embed>.

Type: oembed · Stored attribute type: string

Stored value

string — the embed URL (YouTube, Vimeo, Twitter, etc.)

Supports

  • URL-typed input with placeholder for common embed providers
  • Live preview in the editor via the <wp-embed> web component

Config options

OptionTypeDefaultDescription
helpTextstringOne-line description shown below the input.

Gotchas

  • Stored value is a plain URL — render-side code must run it through wp_oembed_get() (PHP) or your own provider handler (React) to produce the embed markup.
  • No client-side validation that the URL is actually embeddable. Authors can paste any string.

Example

JSON
{ "id": "ctrl_video",
  "type": "oembed",
  "label": "Hero video",
  "attributeKey": "video",
  "parentPanelId": "panel" }

Consume

JSX

JSX
export default function Embed({ attributes }) {
  const url = attributes.video;
  if (!url) return null;
  // Use your framework's embed component, or a server-rendered HTML chunk.
  return <iframe src={url} title="Embedded media" />;
}

PHP

PHP
<?php
$url = $attributes['video'] ?? '';
if (!$url) return;
echo wp_oembed_get(esc_url_raw($url));

Every field also takes the keys common to all fields.

Built from GCB Lite 0.4.0 (ce232d4). Source: schemas/controls/oembed.md.

Copyright © 2026 Runchain. WordPress is a trademark of the WordPress Foundation.