Most tutorials for a custom Gutenberg block start with npx @wordpress/create-block, a React edit.js and a build step. Then they tell you to register the block in functions.php.
This one has none of that. I'm going to build a callout box, the kind you'd use for a note, a tip or a warning, with Gutenberg Control Blocks (GCB). The whole block is three small files in a folder. You don't write React, you don't run a build, and you don't register anything.
I'll say that last part again because it's the bit people don't expect: you don't register a GCB block. There's no register_block_type() call and nothing to add to functions.php. You add a folder to your theme and the block exists.
What you need
- WordPress 6.8 or later and a theme you can edit.
- The Gutenberg Control Blocks plugin, installed and active. It's a paid plugin for developers and agencies.
That's the whole list. No Node, no npm, no webpack.
Step 1: make a folder
In your theme, create a blocks folder if there isn't one, and a folder inside it for the block:
wp-content/themes/your-theme/blocks/callout/
The folder name is the block's name. blocks/callout/ becomes the block gcb/callout.
Step 2: block.json
This is WordPress's own block metadata file, the same one every core block has. Nothing in it is specific to GCB.
{ "apiVersion": 3, "name": "gcb/callout", "title": "Callout", "description": "A box that makes a short message stand out. Your client types the words on the page and picks its tone.", "category": "design", "icon": "megaphone", "supports": { "html": false }, "style": "file:./style.css"}Two things are missing on purpose. There's no attributes list, because GCB makes the attributes from your fields. And there's no render key, because GCB uses the render.php in the folder.
Step 3: block.fields.json
This file lists what your client can change. Each field has a type, a label and the attribute it saves to.
{ "controls": [ { "id": "c_heading", "type": "text", "label": "Heading", "attributeKey": "heading", "default": "Good to know", "validation": { "required": true, "maxLength": 60 } }, { "id": "c_text", "type": "textarea", "label": "Text", "attributeKey": "text", "default": "Say the one thing your reader shouldn't miss.", "validation": { "maxLength": 240 } }, { "id": "c_tone", "type": "select", "label": "Tone", "attributeKey": "tone", "default": "note", "options": [ { "value": "note", "label": "Note" }, { "value": "tip", "label": "Tip" }, { "value": "warning", "label": "Warning" } ] } ]}Three fields: a heading that has to be filled in and can't run past 60 characters, some text, and a tone picked from a list. There are 42 field types to choose from, including images, links, repeaters and post pickers.
Step 4: render.php
This is the template. It reads the values from $attributes, exactly as a core block's PHP render does.
<?php/** * Callout: a heading and a short message in a box, in one of three tones. * * The heading and the text are marked data-gcb-field, so they are typed where they sit on the page. * Tone has no marker, so it appears in the block's sidebar. * * @var array $attributes The block's field values. */ $tones = array( 'note', 'tip', 'warning' );$tone = in_array( $attributes['tone'] ?? '', $tones, true ) ? $attributes['tone'] : 'note';?><aside <?php echo get_block_wrapper_attributes( array( 'class' => 'callout callout--' . $tone ) ); ?>> <p class="callout__heading" data-gcb-field="heading" data-gcb-field-type="text"><?php echo esc_html( $attributes['heading'] ?? '' ); ?></p> <p class="callout__text" data-gcb-field="text" data-gcb-field-type="textarea"><?php echo esc_html( $attributes['text'] ?? '' ); ?></p></aside>The part to notice is data-gcb-field. It marks an element as editable where it sits. Your client clicks the heading on the page and types. The same goes for the text.
Tone has no marker, so GCB puts it in the block's sidebar as a dropdown.
Step 5: a little CSS
block.json points at a style.css, so add one:
.callout { padding: 20px 24px; border-left: 4px solid #3b6fd4; border-radius: 6px; background: #eef3fc; color: #1d1b18; }.callout--tip { border-left-color: #2e8b57; background: #edf7f1; }.callout--warning { border-left-color: #c9831a; background: #fdf5e6; }.callout__heading { margin: 0 0 6px; font-weight: 700; }.callout__text { margin: 0; line-height: 1.6; }Step 6: there is no step 6
Reload the block editor. Callout is in the inserter.
You didn't register it. You didn't touch functions.php. GCB looks in the active theme's blocks/ folder each time WordPress loads and registers every folder that has a block.json and a block.fields.json. Delete the folder and the block is gone again. There's no list of blocks to keep anywhere.
If you've seen a tutorial or an AI answer telling you to add this for a GCB block, leave it out:
// Not needed with Gutenberg Control Blocks. Don't add this.add_action( 'init', function () { register_block_type( get_template_directory() . '/blocks/callout' );} );What your client sees
They add a Callout and see the real box, because the editor is showing the output of the same render.php your visitors get. There's one template, so the editor and the page can't drift apart.
They click the heading and type. They pick Note, Tip or Warning in the sidebar and the colour changes. If they clear the heading and press Save, WordPress refuses, tells them "Heading is required", and leaves the saved page as it was. That check runs on the server as well as in the browser.
The same block in a headless front end
If your front end is React, Vue, Svelte or anything else, the template can live there. Keep block.json and block.fields.json in the theme, leave render.php out, and write the block as a component with the same markers:
export default function Callout({ attributes }) { return ( <aside className={`callout callout--${attributes.tone}`}> <p className="callout__heading" data-gcb-field="heading" data-gcb-field-type="text">{attributes.heading}</p> <p className="callout__text" data-gcb-field="text" data-gcb-field-type="textarea">{attributes.text}</p> </aside> );}The block editor asks your front end to draw the block and puts the result on the canvas, so your client still types on the real thing. Going headless is optional. Most sites never need it.
When you'd still write React
A block that's really an app, like a calculator or a booking form, is still a job for React and @wordpress/create-block. Those sit happily on the same site, because a GCB block is a standard WordPress block too.
But most of what a theme is made of is heroes, cards, callouts, team grids and galleries. For those, three files and no registration is enough.
Where to go next
- Seventeen finished blocks to download and read, including a hero, a team grid and a store locator.
- The same blocks on GitHub, with this callout in
blocks/callout. - How to build a block, both ways, in more detail.
- The field reference, all 42 types.