← All posts

WordPress block patterns: let clients build pages without wrecking the design

Clients want to create pages on their own, but every new page drifts further from the mockup. Theme block patterns fix that: ready-made sections, light locking and your own categories.

WordPress block patterns: let clients build pages without wrecking the design

Key points

  • Drop a PHP file in the theme’s patterns/ folder and WordPress registers it automatically.
  • Removing the generic core and directory patterns keeps clients inside the brand.
  • Block locking protects key elements while leaving text editable.

Almost every WordPress project comes with the same request: “we want to build our own pages”. Six months after launch, you find red headings, buttons in three sizes and columns stacked by hand. The client did nothing wrong; they were handed a blank editor and dozens of blocks. The most reliable answer we have found is a set of block patterns shipped with the theme.

A pattern is a section waiting for content

A block pattern is a group of blocks inserted in one click: an offer banner, a testimonial grid, a pricing table. The client picks a section that already follows the design system and only changes words and images.

Since WordPress 6.0, you just add a file to the theme’s patterns/ folder. The header describes the pattern; the rest is block markup, which you get by building the section in the editor and copying it from the Code editor view.

<?php
/**
 * Title: Offer banner with button
 * Slug: montheme/offer-banner
 * Categories: montheme-sections
 * Keywords: hero, banner, quote
 * Viewport Width: 1280
 */
?>
<!-- wp:group {"align":"full","className":"is-style-offre","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull is-style-offre">
<!-- wp:heading {"level":2} -->
<h2 class="wp-block-heading"><?php esc_html_e( 'Your offer title', 'montheme' ); ?></h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p><?php esc_html_e( 'Two sentences that explain the benefit.', 'montheme' ); ?></p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"lock":{"move":true,"remove":true}} -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/contact/"><?php esc_html_e( 'Request a quote', 'montheme' ); ?></a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
</div>
<!-- /wp:group -->

Using PHP inside the file makes the strings translatable, which matters on a bilingual site. One trap we keep seeing: if the pasted markup doesn’t match what the block expects, the editor shows “This block contains unexpected or invalid content”. Copy the markup from the editor instead of typing it.

Organise and declutter

Out of the box, the inserter also lists WordPress’s own patterns and the ones from the online directory. They look nice but ignore your colours and spacing. On client sites we remove them and group ours under a dedicated category:

// functions.php
add_action( 'init', function () {
    register_block_pattern_category( 'montheme-sections', array(
        'label' => __( 'Site sections', 'montheme' ),
    ) );
} );

// Hide core patterns and the ones from the online directory
add_action( 'after_setup_theme', function () {
    remove_theme_support( 'core-block-patterns' );
} );
add_filter( 'should_load_remote_block_patterns', '__return_false' );

Name patterns the way the client talks (“Offer banner”, “Trust strip”, not “Hero v2”) and add keywords: that’s what they will type into the inserter search.

Lock what shouldn’t move

The lock attribute on the Buttons block above prevents accidental moving or deleting, while the button label stays editable. It’s a safety rail rather than a wall: anyone with editing rights can unlock the block from the toolbar. For most clients, that’s the right balance.

Don’t lock everything. A page where nothing moves is frustrating, and people will work around it with a Custom HTML block, which is worse.

Synced or not

A theme pattern is copied into the page when inserted, so editing the pattern file later won’t change existing pages. For content that must be identical everywhere, such as a guarantee box or contact details, create a synced pattern in the editor instead: one edit updates every page using it.

If a theme change is likely down the road, register patterns from a small plugin with register_block_pattern() so they outlive the theme.

FAQ

Do patterns work with a classic theme?

Yes, as long as pages are edited in the block editor. The patterns/ folder has been supported for all themes since WordPress 6.0.

Can I update a pattern already used on fifty pages?

Not in one go unless it’s synced: each page keeps its own copy. Decide early which sections need to be synced.

Want a WordPress site your team can grow without damaging the design? We build custom themes with patterns designed around your content.

Share LinkedIn Facebook X WhatsApp
</>

webtestudio

Web agency: custom WordPress sites, premium themes and SaaS software.

Discuss your project →