GCBGutenberg
Control Blocks
Buy

Getting started

CLI scaffolding

Everything the visual builder does, the command line does too. wp gcblite scaffold writes the same block.json + block.fields.json into your theme, through the exact same scaffolder the admin UI calls, so the output is identical either way. Reach for it when you're in a terminal, scripting a setup, running in CI, or piping a spec in from another process (an AI agent, a generator, anything).

Requires WP-CLI. Run from anywhere inside your WordPress install. Blocks land in the active theme's blocks/{name}/ by default.

Quickest start

Give it a name and a comma-separated list of controls:

Shell
wp gcblite scaffold hello-world \
  --title="Hello World" \
  --controls="name:text:Name,intro:textarea:Intro"

That writes blocks/hello-world/block.json and blocks/hello-world/block.fields.json, then prints where they went.

The --controls format

Each control is attributeKey:type:Label, entries joined by commas:

Text
name:text:Name,intro:textarea:Intro,cta:url:Call to action
  • attributeKey (required) — the key you'll read when rendering.
  • type — any control type (text, textarea, url, image, select, …). Defaults to text if omitted.
  • Label — the Inspector label. Defaults to a title-cased version of the key (hero_text → "Hero Text") if omitted.

So name:text and name:text:Name produce the same control; name alone gives you a text control labelled "Name".

Options

FlagWhat it does
<name>Block slug — lowercase, hyphenated. Required unless you pass --spec or --stdin.
--title=<title>Display title. Defaults to a title-cased <name>.
--description=<text>Block description.
--icon=<dashicon>Dashicon name. Default admin-generic.
--category=<cat>Block category. Default widgets.
--controls=<csv>Controls in the attributeKey:type:Label format above.
--spec=<file>Read a JSON spec from a file (see below).
--stdinRead a JSON spec from stdin — the path built for agents/pipes.
--forceOverwrite an existing block directory.
--dry-runPrint the resolved block.json and the files it would write, without touching disk.

Always safe to preview first:

Shell
wp gcblite scaffold hello-world --controls="name:text" --dry-run

JSON specs (files & pipes)

For anything past a couple of simple controls, describe the block as JSON. The shape:

JSON
{
  "block_name": "hello-world",
  "meta": {
    "title": "Hello World",
    "description": "A friendly greeting block.",
    "icon": "smiley",
    "category": "widgets"
  },
  "gcb": {
    "controls": [
      { "id": "ctrl_name",  "type": "text",     "label": "Name",  "attributeKey": "name",  "default": "world" },
      { "id": "ctrl_intro", "type": "textarea", "label": "Intro", "attributeKey": "intro",
        "validation": { "maxLength": 200 } }
    ]
  }
}

block_name is the only required key; meta and gcb fill in defaults if omitted. Because gcb.controls is the same array that lands in block.fields.json, you get the full control vocabulary here — defaults, validation, conditional logic, groups — not just the three fields the inline --controls shorthand exposes.

Point at a file:

Shell
wp gcblite scaffold --spec=./hello-world.json

Or pipe it in on stdin — handy when the spec is generated rather than stored:

Shell
cat hello-world.json | wp gcblite scaffold --stdin

# or straight from a generator / agent
echo '{"block_name":"hello-world","gcb":{"controls":[
  {"attributeKey":"name","type":"text","label":"Name","default":"world"}
]}}' | wp gcblite scaffold --stdin

After scaffolding

You've got the folder and its two files — same state as clicking + New in the admin. From here it's identical to the Quickstart: add or refine fields (in the file or the visual builder, your choice), then give the block its markup. To render it, see step 4 of the Quickstart.

Driving GCB from an AI agent rather than a shell? The same --stdin path works for piped specs, and agents can also introspect and render blocks over the WP Abilities API — see AI workflows.

From the authoring guide

Scaffolding

Shell
# Single command, no boilerplate.
wp gcblite scaffold team-grid --title="Team Grid" --controls="heading:text,intro:textarea"

# Or pipe a JSON spec from an AI:
cat spec.json | wp gcblite scaffold --stdin

Spec shape:

JSON
{
  "block_name": "team-grid",
  "meta": { "title": "Team Grid", "icon": "groups", "category": "widgets" },
  "gcb": {
    "controls": [...]
  }
}

Commands in the code

Reference, generated from the plugin source

wp gcblite scaffold

Generate a GCB Lite block.

Options

  • [<name>] Block slug (lowercase, hyphenated). Required unless --spec or --stdin.
  • [--title=<title>] Display title. Defaults to a title-cased version of <name>.
  • [--description=<description>] Block description.
  • [--icon=<icon>] Dashicon name. Default: admin-generic.
  • [--category=<category>] Block category. Default: widgets.
  • [--controls=<csv>] Control definitions as attributeKey:type[:Label] pairs joined by commas.
  • [--spec=<file>] Path to a JSON spec describing the block.
  • [--stdin] Read a JSON spec from stdin (for AI agents).
  • [--force] Overwrite an existing block directory.
  • [--dry-run] Print the resolved block.json without writing files.

Examples

Shell
wp gcblite scaffold team-grid --title="Team Grid" --controls="heading:text,intro:textarea"
wp gcblite scaffold --spec=./team-grid.json
cat team-grid.json | wp gcblite scaffold --stdin

Source: includes/CLI/ScaffoldCommand.php

wp gcblite seed-showcase

Seed the /all-fields demo page + supporting fixtures. Creates (or updates) a sample post, two demo categories, and an /all-fields page containing a single gcb/field-showcase block with realistic media + reference attributes. Used by the Playground blueprint and as a one-shot setup for staging / Kinsta installs that want the same demo content.

Options

  • [--quiet] Suppress the success summary. Useful for blueprint scripts that echo their own output.

Examples

Shell
# Local site with wp-cli on $PATH
wp gcblite seed-showcase
# SSH'd into a remote (Kinsta, staging) — same command
wp gcblite seed-showcase
# As part of a larger setup script
wp gcblite seed-showcase --quiet

Source: includes/CLI/SeedShowcaseCommand.php

Built from GCB Lite 0.4.0 (ce232d4). Source: AGENTS.md, includes/CLI/.

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