Block patterns are pre-designed block compositions users can insert from the pattern library. WP Rig 3.5 ships a complete pattern story for universal and block-based themes: a registry component that seeds categories from config, scaffolding, linting, and a bake path that turns Site Editor-created patterns into theme files. Paradigm note: this entire stack is gated to universal and block-based themes — the classic core never registers patterns.
The pattern registry (inc/Block_Patterns)
The inc/Block_Patterns component does two jobs on init:
- Registers pattern categories seeded from
patterns.categoriesin your config chain, filterable viawprig_block_pattern_categories. - Registers patterns from installed registry components’ bundled
patterns/directories via thewprig_block_patternsfilter — a local equivalent of the (still absent) coreregister_block_patterns_from_directory(). Component pattern slugs are prefixed with the owning component so two components can never collide.
Theme-level patterns/ auto-registration (the standard WordPress mechanism) is untouched — WP Rig adds registry patterns alongside it.
Scaffolding with rig:pattern
npm run rig:pattern hero-sectionThis creates patterns/hero-section.php with i18n-aware headers and your config-seeded categories ready to go:
<?php
/**
* Title: Hero Section
* Slug: wprig/hero-section
* Categories: featured
* Keywords: hero, banner
*/
?>
<!-- wp:cover -->
<!-- wp:heading --><h2>Hello world</h2><!-- /wp:heading -->
<!-- /wp:cover -->Linting patterns
npm run lint:patterns validates every pattern in patterns/ and component patterns/ dirs — metadata headers (Title/Slug/Categories), block-markup validity against the active core schemas, and i18n correctness. It runs as part of npm run ai:check, so pattern quality is enforced on every pre-flight.
Patterns baked from the Site Editor (Baked: yes header) get a tolerance profile: scaffold-placeholder content downgrades to a warning, and the sanctioned runtime-URL PHP expressions in block attributes are neutralized — any other PHP still fails.
The Site Editor flow
The full round-trip for user-created patterns: create the pattern in the Site Editor → npm run rig:bake writes it to patterns/<slug>.php (published unsynced patterns only) → review the diff, commit → rig:bake:clean removes the DB record after verification. See Site Editor Bake & Sync for the complete workflow and safety model.
Seeding categories from config
Pattern categories live in your config chain (patterns.categories), so a theme and its children share one category vocabulary. Components can register their own categories through the same system — everything resolves through the paradigm gates so classic themes stay pattern-free.
Related reading
Site Editor Bake & Sync (the bake round-trip), Building Custom Blocks (blocks vs patterns), and Theme Paradigms (the gating model).