Block Development

Guides for developing custom WordPress blocks.

Source: Various block-related files in wp-includes/

Topics

TopicDescription
block-json-schema.mdblock.json schema and fields
attributes.mdBlock attributes system
supports.mdBlock supports (color, spacing, etc.)
context.mdBlock context passing
inner-blocks.mdNested block support
variations.mdBlock variations
transforms.mdBlock transforms
deprecations.mdBlock deprecations
dynamic-blocks.mdServer-rendered blocks
bindings.mdBlock bindings API
styles.mdBlock styles
scripts-styles.mdBlock asset loading
hooks.mdBlock development hooks

Quick Reference

Registration

php
register_block_type( __DIR__ . '/build' );
register_block_type_from_metadata( __DIR__ );

Key Functions

  • register_block_type() – Register a block type
  • register_block_style() – Register block style variation
  • register_block_pattern() – Register block pattern