Skip to content

WordPress block patterns broken: a recovery walkthrough

WordPress block patterns can break for half a dozen distinct reasons — missing block dependencies, stale registrations, theme update incompatibilities. The walkthrough that surfaces and fixes each cause.

A WordPress site’s block patterns library used to work. The editor opens the patterns sidebar, scrolls, and the patterns appear as broken empty boxes — no preview, no insert option. Or the patterns insert but immediately show validation errors (“This block contains unexpected or invalid content”). Or some patterns work, others do not, and the team cannot trace the inconsistency. Block patterns break for half a dozen distinct reasons, and the walkthrough below surfaces each one — a checklist we run on most enterprise WordPress hosting accounts after major plugin or theme updates.

What’s happening

A block pattern is a saved arrangement of WordPress blocks that the editor knows how to insert. For the insertion to succeed, every block referenced in the pattern must:

  1. Be registered (the plugin or theme that defines it is active).
  2. Be at a compatible version with the pattern’s assumptions.
  3. Pass the block validator (the saved HTML structure matches what the block’s save() function currently outputs).

When any of these fails, the pattern either does not appear at all, appears as a broken preview, or inserts as an invalid block. Common failure surfaces:

  • A plugin that provided custom blocks was deactivated or uninstalled.
  • The plugin updated and changed the block’s structure, so saved patterns from the old version fail validation.
  • The theme was switched and the new theme registers different patterns.
  • The pattern’s image attachments were deleted from the media library.
  • WordPress core updated and the block’s save format changed (rare but happens during major releases).

How to verify

Identify which patterns are failing and what they depend on:

# list registered patterns
wp eval 'foreach (WP_Block_Patterns_Registry::get_instance()->get_all_registered() as $p) { echo $p["name"] . " => " . ($p["categories"][0] ?? "uncategorized") . "\n"; }'

# list synced patterns (database-stored)
wp post list --post_type=wp_block --fields=ID,post_name,post_status

# inspect a specific failing pattern's content
wp post get <ID> --field=post_content

For a synced pattern that inserts as broken content, look at what blocks it contains:

wp post get <ID> --field=post_content | grep -oE 'wp:[a-z-]+/[a-z-]+'

Cross-reference these block names against the active plugins:

wp plugin list --status=active --format=table

If a block name like wp:acme-blocks/hero appears but the Acme Blocks plugin is not in the active list, the pattern references a block that no longer exists. That is your failure mode.

For preview issues specifically, open the browser DevTools while loading the patterns sidebar and look for 404s on image URLs or JS errors mentioning block registration.

The fix

The walkthrough, by failure mode:

  1. Missing block dependency. A pattern references a block from a plugin that is not active. Either reactivate the plugin or rewrite the pattern using core blocks only. To rewrite a synced pattern:

    wp post update <ID> --post_content='<!-- wp:paragraph --><p>...</p><!-- /wp:paragraph -->'

    For theme-provided patterns, edit the PHP file in wp-content/themes/your-theme/patterns/.

  2. Block version mismatch. A plugin updated and changed the block’s HTML structure. The saved pattern fails validation. Options: (a) open the pattern, click “Attempt block recovery” — WordPress will try to upgrade it; (b) rewrite the pattern manually.

  3. Theme switched and patterns disappeared. Theme-provided patterns belong to the theme. Switching themes loses them. The previous theme’s patterns are still in the theme files at wp-content/themes/old-theme/patterns/ but no longer registered. To preserve patterns across theme switches, move the canonical ones to a small custom plugin that registers them independently of the theme.

  4. Pattern previews broken (empty boxes). Usually a 404 on an image referenced in the pattern. The pattern HTML uses <!-- wp:image {"id":123} --> and image 123 no longer exists in the media library. Either re-upload the image with the same ID (difficult), update the pattern to use a different image, or use a placeholder image URL that always exists.

  5. Plugin uninstalled and patterns it provided are gone. Plugin patterns are registered at plugin load. Uninstalling the plugin removes them. If you want to keep them, copy the registration code into a small mu-plugin before uninstalling.

  6. Synced patterns broken after a multisite content sync. Synced patterns live in wp_posts as wp_block post type. When syncing content between sites, ensure these are included in the export/import. If the sync omitted wp_block posts, re-import them.

  7. Patterns from the WordPress.org pattern directory not appearing. These are fetched from the pattern directory and cached. The cache lives in a transient that WordPress hosting operators flush during release windows. To refresh:

    wp transient delete --all

    Then reload the editor.

For WordPress sites where the patterns library has accumulated breakage across plugin changes and theme switches, Stack Harbor includes pattern inventory and reconstruction as part of enterprise WordPress hosting operations. Book a WordPress consult if your editorial team has stopped using patterns because half of them throw validation errors.