WordPress Block Editor Development: Concepts and Tooling
The concepts behind block editor (Gutenberg) development: block.json, static vs dynamic blocks, attributes, the build tooling, patterns, variations, styles and where each fits.

Block editor development means extending WordPress's editor (Gutenberg) with your own blocks, patterns, variations and styles. A block is defined by a block.json metadata file, an editor script written in JavaScript (usually React via the @wordpress packages) and, for front-end output, either saved HTML (a static block) or a PHP render callback (a dynamic block). The official @wordpress/scripts and @wordpress/create-block tools handle the build.
Before you write a block, check whether a pattern, a block variation or a block style would do the job with far less code. This guide explains the options and the tooling; the step-by-step build is in how to create a custom Gutenberg block.
The extension options, from lightest to heaviest
| Option | What it is | Use when |
|---|---|---|
| Block style | A CSS class variant of an existing block | A "rounded" image or "outline" button |
| Block pattern | A saved arrangement of existing blocks | Reusable layouts: hero, pricing table, CTA |
| Block variation | An existing block with preset attributes, shown as its own item | A "Testimonial" group or a "Latest projects" query loop |
| Block filters | Hooks that change existing blocks' settings or output | Adding a control or attribute to core blocks |
| Custom block | A new block with its own markup and controls | Interactive components, structured data entry, custom output |
Patterns and variations need little or no JavaScript; see block patterns and template parts and block filters.
block.json: the source of truth
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "tle/notice",
"title": "Notice",
"category": "text",
"icon": "info",
"attributes": {
"message": { "type": "string", "source": "html", "selector": "p" },
"tone": { "type": "string", "default": "info" }
},
"supports": { "color": { "background": true }, "spacing": { "padding": true } },
"editorScript": "file:./index.js",
"style": "file:./style-index.css",
"render": "file:./render.php"
}
WordPress reads it in PHP with register_block_type( __DIR__ . '/build/notice' ), so the same definition serves the editor, the server, the REST API and the block directory. Use the latest apiVersion your minimum WordPress version supports.
Attributes
Attributes are the block's data. They are stored either in the block's HTML comment delimiter as JSON, or sourced from the saved markup ("source": "html"). Keep them minimal and typed. Data that belongs to the post rather than the block (a price, an event date) is better stored as post meta.
Static vs dynamic blocks
- Static blocks save their final HTML into post content via a
save()function. Fast to serve, but changing the markup later causes "This block contains unexpected or invalid content" unless you add a deprecation. - Dynamic blocks save only attributes and render HTML in PHP on each request (
render.phporrender_callback). Ideal for content that changes (latest posts, prices, user-specific data) and easier to evolve.
Many teams default to dynamic blocks for anything non-trivial. See dynamic blocks with PHP.
Supports: features for free
The supports key turns on standard editor controls (colors, typography, spacing, alignment, anchors, custom class names) without writing UI code, and integrates with theme.json presets (theme.json explained).
The tooling
npx @wordpress/create-blockscaffolds a plugin with a working block,block.jsonand build setup.@wordpress/scriptswraps webpack and Babel:npm startfor development,npm run buildfor production, plus lint and test commands. It also generatesindex.asset.phpwith script dependencies and a version hash.@wordpress/components,@wordpress/block-editor,@wordpress/data: UI components, editor controls and the data stores.wp-env: a Docker-based local WordPress for testing (local environments).
Interactivity on the front end
For front-end behaviour (tabs, toggles, filters), WordPress provides the Interactivity API, a small directive-based system designed for blocks, instead of each block shipping its own framework. See the Interactivity API.
Where block code should live
Blocks are content: if a block disappears, posts that use it break. Put custom blocks in a plugin, not in the theme, so content survives a theme change. Themes provide styles, patterns and templates.
Common mistakes
- Building a custom block when a pattern or variation would do.
- Changing a static block's
save()output without a deprecation, invalidating existing content. - Registering blocks without
block.json, missing out on server-side registration and asset handling. - Loading block CSS and JS on every page instead of letting WordPress load them only where the block is used.
- Storing post-level data in block attributes.
Frequently asked questions
Do I need React to build WordPress blocks?
The editor side is written with React-based @wordpress packages, so basic React knowledge helps. Patterns, variations, styles and dynamic PHP rendering need little or none.
What is block.json?
The metadata file that defines a block's name, attributes, supports and assets, used by both PHP and JavaScript.
Should I use static or dynamic blocks?
Dynamic for content that changes or markup you expect to evolve; static for simple, stable markup where serving saved HTML is enough.
Is ACF Blocks an alternative?
Yes. Advanced Custom Fields lets you build blocks with PHP templates and field groups, which suits PHP-focused teams. Native blocks give more control over the editing experience.
Conclusion
Start from the lightest option that solves the problem, define real blocks with block.json, prefer dynamic rendering for anything that may change, and let @wordpress/scripts handle the build. References: the Block Editor Handbook and the block.json reference.
Need custom blocks built for your editors? Talk to our developers.
Save this practical guide
Add us as a preferred Google source, or ask an AI assistant to summarize this page and link back to the original guide when it is useful.
