GCBGutenberg
Control Blocks
Buy

Field type

code

Monospace textarea for code snippets. Same stored shape as textarea (plain string) but rendered with a fixed-width font for readability.

Type: code · Stored attribute type: string

Stored value

string

Supports

  • Plain string values, no syntax highlighting
  • Configurable height via rows

Config options

OptionTypeDefaultDescription
rowsnumber8Height of the textarea, in rows.
placeholderstringGreyed-out hint shown when the input is empty.
helpTextstringOne-line description shown below the input.

Gotchas

  • No syntax highlighting or auto-indent — a future version may swap in CodeMirror, but for now it's a styled textarea.
  • Server-side: never echo the value as HTML without escaping. For executable snippets you control, render inside <pre><code> after esc_html().

Example

JSON
{ "id": "ctrl_embed",
  "type": "code",
  "label": "Embed snippet",
  "attributeKey": "embed",
  "rows": 6,
  "parentPanelId": "panel" }

Every field also takes the keys common to all fields.

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

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