Skip to main content
Block Patterns are predefined block layouts that appear in the patterns tab of the block inserter. They provide users with ready-made designs they can insert and customize.

What are Block Patterns?

Patterns combine multiple blocks into reusable layouts. Once inserted, the blocks become regular editable blocks that users can modify.
Unlike reusable blocks, patterns are not linked to their original definition. Changes to a pattern don’t affect previously inserted instances.

Registering Patterns (PHP)

Register patterns using the register_block_pattern function:

register_block_pattern

string
required
Machine-readable name with format namespace/pattern-name
array
required
Array of pattern properties

Pattern Properties

string
required
Human-readable title displayed in the inserter
string
required
Block HTML markup for the pattern
string
Visually hidden text describing the pattern (helpful for search)
array
Array of registered pattern category slugs
array
Search keywords to help users discover the pattern
integer
Intended width for scaled preview in the inserter
array
Block types this pattern is intended for (enables pattern transforms)
array
Post types where this pattern is available
array
Template types where the pattern makes sense (e.g., 404, single-post)
boolean
default:"true"
Whether to show in the inserter (set to false for programmatic use only)
string
Source of the pattern: plugin or theme

Basic Pattern Example

Pattern with Multiple Blocks

Pattern Categories

Register custom pattern categories:

register_block_pattern_category

string
required
Machine-readable category identifier
array
required
Array with category properties
The category will only appear in the patterns tab if at least one pattern is assigned to it.

Core Pattern Categories

  • featured
  • text
  • gallery
  • call-to-action
  • banner
  • header
  • footer
  • posts
  • buttons

Contextual Patterns (Pattern Transforms)

Attach patterns to specific block types to enable pattern transformations:
This pattern will:
  1. Appear in the paragraph block’s transform menu
  2. Keep the paragraph’s existing content
  3. Apply the pattern’s styling attributes

Multi-Block Patterns

Patterns can target multiple block types:

Semantic Block Patterns

For block themes, mark patterns as template part areas:
Similarly for footers:

Restricting Patterns by Post Type

Restricting by Template Type

Hidden Patterns (Programmatic Use)

Use programmatically:

Unregistering Patterns

unregister_block_pattern

Unregister Pattern Categories

Pattern Examples from Core

Two Columns Pattern

Call to Action Pattern

Tips for Creating Patterns

Provide meaningful placeholder content that demonstrates the pattern’s purpose.
Use viewportWidth to ensure patterns preview correctly in the inserter.
Write clear descriptions to help users understand when to use each pattern.
Assign patterns to appropriate categories to improve discoverability.
Include search terms that users might type when looking for the pattern.
If using blockTypes, ensure transforms work correctly with user content.

Best Practices

  1. Register on init hook: Always register patterns during the init action
  2. Escape content: Use esc_html__() for translatable text
  3. Use consistent naming: Follow namespace/pattern-name convention
  4. Provide translations: Wrap all user-facing strings in translation functions
  5. Consider accessibility: Ensure patterns use semantic HTML and proper heading hierarchy

Next Steps

Inner Blocks

Build blocks that contain other blocks

Block API Overview

Return to Block API fundamentals