Technical
WordPress Custom Blocks: Letting Clients Edit Without Breaking
Every WordPress handoff has the same tension. The client wants to edit the homepage. The developer wants to keep the layout intact. Give them a blank editor and they break the design within a week. Give them nothing and they call you for every typo.
Custom Blocks Are The Answer
A custom block is a small, structured piece of the page that the client can drop in, fill out, and rearrange. They cannot change the typography or the spacing. They can only change the content inside the slots you built.
// plugin/blocks/feature-card.php
register_block_type('plai/feature-card', array(
'attributes' => array(
'heading' => array('type' => 'string'),
'body' => array('type' => 'string'),
'icon' => array('type' => 'string', 'enum' => array('speed', 'shield', 'cloud')),
),
'render_callback' => 'render_feature_card',
));The enum on icon is the magic. The client picks from three icons I designed. They cannot upload a broken JPG or pick a clashing color. The design stays intact because the inputs are constrained.
Build Agentically
Claude Code writes the block scaffolding in about five minutes per block. I describe the block's fields, which inputs are constrained, and the expected HTML. It generates the PHP, the block.json, the editor component, and the render callback. I review and ship.
The Handoff Document
One-page PDF with a screenshot of each block and the fields it exposes. That is the entire training material. Clients skim it and get to work. Support calls drop to near zero on the first week.
See the WordPress Block API for the full attribute and render options. Constrained editing is how you deliver a site clients can own without destroying.
RELATED READING
The Consulting Shift I Am Making In Year Two
After a year of writing and building, my consulting practice is changing shape. Shorter engagements. Sharper outcomes.
ReadThe Frontend Shift: Shipping Less JavaScript In Year Two
A year ago I reached for Next.js for everything. This year I often reach for nothing.
ReadThe Serverless Lesson I Would Write On A Sticky Note
After a year of shipping serverless projects, one rule explains most of the wins and all of the losses.
Read