Field type
embed
A third-party widget — the snippet a provider gives you (Trustpilot, Calendly, Typeform, Elfsight…), pasted as it is. The render prints its markup and loads its <script src> when the host of that script is a known widget provider; any other script, inline code and HTML comments are dropped.
Type: embed · Stored attribute type: string
Stored value
string — the provider's snippet, markup and script tags as pasted
Supports
- Monospace textarea the snippet is pasted into
- A
<script src>from a known widget host (thegcblite_embed_hostsfilter) is enqueued in the footer once per page, its async / defer kept - The markup passes wp_kses: div, span, a, p, iframe (https only), img and blockquote, with class, id, style, href, src, sizes, title and any data-* attribute
Config options
| Option | Type | Default | Description |
|---|---|---|---|
rows | number | 8 | Height of the textarea, in rows. |
helpText | string | One-line description shown below the input. Defaults to a line on what to paste. |
Gotchas
- Inline
<script>code never runs, and neither does a script from a host off the list — add a provider through thegcblite_embed_hostsfilter. - Render it with
gcblite_embed($attributes["key"] ?? null, $fallback)(gcb-lite includes/Render/embed.php), never by echoing the value. - The widget draws itself in the browser; the block editor's preview shows its markup only.
Example
{ "id": "ctrl_reviews",
"type": "embed",
"label": "Trustpilot widget",
"attributeKey": "reviews",
"parentPanelId": "panel" }Consume
PHP
<?php
// render.php — the snippet's markup, its provider's script enqueued once
echo gcblite_embed($attributes['reviews'] ?? null);Every field also takes the keys common to all fields.