WordPress Development

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.json file next to the WordPress block editor showing a custom block with its settings sidebar

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

OptionWhat it isUse when
Block styleA CSS class variant of an existing blockA "rounded" image or "outline" button
Block patternA saved arrangement of existing blocksReusable layouts: hero, pricing table, CTA
Block variationAn existing block with preset attributes, shown as its own itemA "Testimonial" group or a "Latest projects" query loop
Block filtersHooks that change existing blocks' settings or outputAdding a control or attribute to core blocks
Custom blockA new block with its own markup and controlsInteractive 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.php or render_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-block scaffolds a plugin with a working block, block.json and build setup.
  • @wordpress/scripts wraps webpack and Babel: npm start for development, npm run build for production, plus lint and test commands. It also generates index.asset.php with 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.

· Tutor LMS developers

Guides written and reviewed by the TutorLMS Expert development team. Every hook, function, table and setting we mention is checked against the Tutor LMS and Tutor LMS Pro source code before it is published.

Keep reading

Need a custom Tutor LMS solution?

Tell us what you are building or what is broken. A Tutor LMS developer reads every inquiry and replies with next steps and a free estimate.

Get a free Tutor LMS consultation

Tell us what you are building or fixing. A Tutor LMS developer replies with honest advice and next steps.

  • No obligation
  • Tutor LMS and Pro specialists
  • Your details stay private

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.