Skip to main content
Block Patterns are predefined block layouts available from the patterns tab of the block inserter. Once inserted, blocks are ready for additional content and configuration.

What are Block Patterns?

Patterns provide:
  • Reusable layouts: Pre-configured combinations of blocks
  • Quick starting points: Jump-start content creation with templates
  • Design consistency: Ensure layouts match your design system
  • User productivity: Speed up common content creation tasks

Registering Block Patterns

PHP Registration

Use register_block_pattern() to register a pattern:
Call register_block_pattern() from a handler attached to the init hook.

Pattern Properties

Required Properties

title (required)

Human-readable title displayed in the pattern inserter.

content (required)

Block HTML markup for the pattern. This is the serialized block format.

Optional Properties

description

A visually hidden text used to describe the pattern in the inserter. Helps users discover patterns while searching.

categories

Array of registered pattern categories to group the pattern.

keywords

Array of aliases or keywords that help users discover the pattern while searching.

viewportWidth

Intended width of the pattern for a scaled preview in the inserter.

blockTypes

Array of block types the pattern is intended for. Makes the pattern available in block transforms.

postTypes

Restrict the pattern to specific post types.

templateTypes

Array of template types where the pattern is relevant.

inserter

Control visibility in the inserter. Set to false to hide the pattern (for programmatic use only).

source

Denotes the source of the pattern.

Complete Pattern Example

Pattern Categories

Group patterns into categories for better organization.

Registering Pattern Categories

The category won’t show in the Patterns panel unless at least one pattern is assigned to it.

Complete Category Example

Unregistering Categories

Unregistering Block Patterns

Remove previously registered patterns:
Call unregister_block_pattern() from a handler attached to the init hook.

Contextual Block Patterns

Patterns can be attached to specific block types, making them available as transforms.
When a user selects a paragraph block, this pattern appears in the transform menu.

Multi-Block Patterns

Patterns can transform multiple selected blocks:
If the user selects both a paragraph and heading, this pattern becomes available.

Semantic Block Patterns

In block themes, mark patterns as “header” or “footer” (template part areas):
These patterns appear when inserting or replacing header/footer template parts.

Common Pattern Examples

Hero Section

Testimonial

Pricing Table

Creating Pattern Content

To generate the block HTML markup for patterns:

Method 1: Copy from the Editor

1

Create the layout in the editor

Build your pattern layout using the block editor.
2

Copy to clipboard

Select all blocks (Cmd/Ctrl + A) and copy them.
3

View as HTML

Click the three dots menu → “Copy all blocks” or use Code Editor view to see the HTML.
4

Paste into your pattern

Paste the HTML markup into the content field.

Method 2: Export from the Editor

Use the Pattern export feature (if available in your WordPress version) to export patterns created in the editor.

Best Practices

  1. Provide clear titles and descriptions: Help users understand when to use each pattern
  2. Use appropriate categories: Make patterns easy to discover
  3. Add keywords: Include search terms users might use
  4. Set viewport width: Ensure patterns display correctly in preview
  5. Use placeholder content: Make it obvious what content should be replaced
  6. Test across themes: Ensure patterns work with different themes
  7. Consider accessibility: Use semantic HTML and proper heading hierarchy
  8. Keep patterns focused: Each pattern should serve a specific purpose

Pattern vs Reusable Block

Use patterns for layout templates. Use reusable blocks for repeated actual content.