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
| Option | Type | Default | Description |
|---|---|---|---|
helpText | string | One-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
{ "id": "ctrl_video",
"type": "oembed",
"label": "Hero video",
"attributeKey": "video",
"parentPanelId": "panel" }Consume
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
$url = $attributes['video'] ?? '';
if (!$url) return;
echo wp_oembed_get(esc_url_raw($url));Every field also takes the keys common to all fields.