You design a page, hand it over, and a month later the hero has three buttons, a table in the middle of the card grid and a heading that runs to four lines. The block editor lets your client do almost anything, and most of the time that's the point. For a theme you built for them, you usually want them to change the words and the pictures, not the structure.
In Gutenberg Control Blocks (GCB) the rules live in the block's own files: the template says which blocks go where and how many, and block.fields.json says which fields must be filled in and how long they can be. WordPress then won't save the page until the rules hold.
Only the right blocks in each area
An <InnerBlocks> marker in the template is a slot your client fills on the canvas. Give it allowedBlocks and only those blocks can go in. A block can have several areas: number each marker with data-gcb-slot, starting at 0, and give each its own list.
<section <?php echo get_block_wrapper_attributes(['class' => 'split-intro']); ?>> <div class="split-intro__words"> <InnerBlocks data-gcb-slot="0" allowedBlocks='["core/heading", "core/paragraph"]' /> </div> <div class="split-intro__actions"> <InnerBlocks data-gcb-slot="1" allowedBlocks='["core/buttons"]' /> </div></section>- Each area offers only its own blocks. An empty area shows a + that lists only the blocks it allows. Here the words area takes headings and paragraphs, and the actions area only buttons.
- The areas belong to the design. Your client can't move, remove or add an area, only fill it.
- Lock the structure too, if you need to. Each marker also takes WordPress's own
templateLock:"insert"lets your client move blocks but not add or remove them, and"all"fixes the structure completely. Pair it with atemplateto set what's there to start with.
For the whole site, rather than one block, WordPress has its own allowed_block_types_all filter, which limits the blocks in the inserter.
How many items a list can have
When the repeated items are blocks of their own, such as cards or team members, the template marks where they go with a <Repeater>. Its limits are attributes on the marker:
<div class="grid"> <Repeater allowedBlocks='["gcb/card"]' addButtonLabel="Add card" min="1" max="6" defaultChildren="3" editLayout="grid" /></div>- At
maxthe Add button goes. Your client can't add a seventh card. - Below
minor overmax, the save is refused, in the post editor and in the Site Editor. - The card only appears inside its parent. Because
allowedBlocksnames it, GCB scopesgcb/cardto this block with WordPress's native parent setting, so it never shows in the inserter anywhere else.
A repeater field (rows of simple values in the sidebar) takes min and max too, for the number of rows.
Required fields and length limits
Any field in block.fields.json can carry a validation rule. A required heading with a length limit looks like this:
{ "controls": [ { "id": "c_heading", "type": "text", "label": "Heading", "attributeKey": "heading", "validation": { "required": true, "maxLength": 48 } }, { "id": "c_intro", "type": "textarea", "label": "Intro", "attributeKey": "intro", "validation": { "maxLength": 160 } } ]}The rules are required, minLength, maxLength, pattern (a regular expression), and min and max for numbers. Your client sees a red ring and a message under the field as soon as the value is wrong. The validation guide covers every rule and message.
Fields that only appear when they apply
A field with conditionalLogic is hidden until its rules pass against the block's other values. Your client only sees the fields that make sense for what they've chosen. Here the notes field appears only when a toggle called show_extra is on:
{ "type": "textarea", "attributeKey": "extra_notes", "label": "Extra notes", "conditionalLogic": { "enabled": true, "operator": "and", "rules": [ { "field": "show_extra", "operator": "==", "value": true } ] }}A hidden field is never checked. If it's required but your client can't see it, it doesn't stop the save.
Choices from your theme, not free typing
A color, spacing or size field can offer your theme's own presets from theme.json. Untick the ones a field shouldn't offer, and your client picks from the rest. The field stores the preset's slug, so a change to theme.json flows through to every block. See Design tokens.
WordPress won't save until it's right
The rules aren't just hints. While any block breaks one:
- the block shows a red banner across its top edge, naming the fields that need fixing;
- Update or Publish is refused, with one notice saying why, such as "Saving failed. Hero: Heading, Intro need fixing.";
- the notice's Find the block button selects the first block that needs fixing and scrolls to it.
Nothing is written until the fields are fixed. The check runs on the server as well as in the browser: the editor reports each block's errors to the server, and a rest_pre_insert_{post_type} filter refuses the save. That covers posts, pages, and templates and template parts in the Site Editor. Autosaves are never blocked.
For a custom post type edited in the block editor, add it with the gcblite_validation_post_types filter: add_filter( 'gcblite_validation_post_types', fn( $types ) => [ ...$types, 'case_study' ] );
Try it
The docs cover the <Repeater> options, multiple InnerBlocks areas, validation and conditional logic. You can also try areas with their own allowed blocks in your browser.