Field type
richtext
Tiptap-backed rich text editor. Lighter than the TinyMCE wysiwyg control — no jQuery, no global state. Renders inline on wide surfaces and as a popover/modal in the narrow block Inspector.
Type: richtext · Stored attribute type: string
Stored value
string — HTML, e.g. <p>Hello <strong>world</strong></p>. Empty document normalises to "".
Supports
- Bold / italic / strike / inline code
- Bullet and numbered lists, blockquote
- Headings (configurable allowed levels)
- Links via a popover
- Image insertion via the media library
- Undo / redo
- Three display modes: inline, popover, modal
Config options
| Option | Type | Default | Description |
|---|---|---|---|
headingLevels | number[] | [2, 3, 4] | Which heading levels appear in the block-type select. |
allowImages | boolean | true | Show the insert-image toolbar button. Set to false for caption-style fields. |
display | string — "inline" | "popover" | "modal" | Force a specific display mode. Default behaviour: popover in sidebar variants, inline on wide surfaces. | |
placeholder | string | Greyed-out hint shown on the collapsed button in popover/modal mode. |
Gotchas
- Empty editor returns
"", not"<p></p>". Required-validation works correctly. - The TinyMCE-based
wysiwygcontrol is a backwards-compat alias for this — same component, same stored HTML shape.
Example
{ "id": "ctrl_body",
"type": "richtext",
"label": "Body",
"attributeKey": "body",
"headingLevels": [2, 3],
"parentPanelId": "panel" }Consume
JSX
export default function Body({ attributes }) {
const html = attributes.body || '';
return <div className="body" dangerouslySetInnerHTML={{ __html: html }} />;
}PHP
<?php
$html = $attributes['body'] ?? '';
?>
<div class="body"><?php echo wp_kses_post($html); ?></div>Every field also takes the keys common to all fields.