WordPress Block Pattern Generator
Generate WordPress block pattern registration code from block markup, with categories, keywords, viewport width, post type restrictions and inserter controls. Runs locally in your browser.
Runs locally in your browserStarter code only. Test the pattern in the WordPress editor and verify any third-party blocks it contains.
Turn tested block markup into a reusable WordPress pattern
WordPress block patterns are predefined block layouts that editors can insert and then customize. This generator takes block markup copied from the WordPress code editor and wraps it in starter registration code for a theme or plugin.
What the generator creates
- A unique namespaced pattern slug.
- A human-readable title and optional description.
- Pattern categories and search keywords.
- An optional preview viewport width.
- Optional post-type restrictions.
- An inserter visibility switch.
- PHP using
register_block_pattern()oninit.
The generated snippet keeps your block markup as the pattern content. Everything runs locally in your browser; WPToolix does not upload the markup.
Before generating
Build and test the layout in the WordPress editor first. Open the editor’s code view and copy the complete block markup, including the <!-- wp:... --> comments. A pattern is a reusable layout, not a replacement for testing whether its individual blocks, attributes and styles are valid.
Theme pattern files versus PHP registration
Modern themes can place pattern files in a /patterns directory and WordPress will auto-register valid files. WordPress’s Theme Handbook recommends that approach for most theme-owned patterns. PHP registration remains useful for plugins, conditional registration, generated patterns and projects where code-based registration is the better ownership model.
Categories and discoverability
Use existing WordPress categories such as featured, banner, call-to-action, contact, gallery, header, footer, services or testimonials when they describe the layout. Custom categories must be registered separately before a pattern can use them reliably.
Block types and post types are different
A block-type association tells WordPress that a pattern is relevant in contexts involving particular blocks. A post-type restriction controls where the pattern is available at all. Use post-type restrictions only when the layout genuinely belongs to a specific content type.
Important limitations
This generator does not validate every nested block attribute, dependency, third-party block, theme style or future WordPress change. It also does not turn static markup into a dynamic block. Test generated code on staging and open the pattern in the actual editor before deploying it.
Practical verification checklist
- Confirm the snippet loads without PHP errors.
- Open the block inserter and search for the pattern title or keyword.
- Insert the pattern and confirm all expected blocks appear.
- Check desktop and responsive layouts.
- Edit text and media to make sure the pattern behaves as reusable starter content.
- If restricted by post type, verify that it appears only where intended.
Frequently asked questions
Are block patterns synced?
Registered code patterns are reusable layouts. After insertion, the blocks become normal editable content; changing the registered pattern later does not rewrite previously inserted content.
Should I put patterns in a plugin or theme?
If the pattern depends heavily on a theme’s design system, theme ownership often makes sense. If it represents reusable functionality or needs to survive theme changes, plugin ownership can be more appropriate.
Can I paste HTML without WordPress block comments?
You can technically register arbitrary content, but a useful editor pattern should normally contain valid block markup. Copying from the WordPress code editor is the safest starting point.
Related: Use the WordPress Plugin Header Generator when packaging patterns in a plugin, or the Custom Post Type Generator when a pattern belongs to a custom content workflow.
