You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Patterns should be discoverable from block editor #28309
There should be a UI flow that makes it easy to discover patterns that contain a given block.
If I'm adding a Buy Now button to content, it should be easy for me to discover that my e-commerce plugin already has some patterns for product layouts that contain the Buy Now button, to save me doing it all manually.
What is your proposed solution?
An issue has been created in the Pattern Directory repo to support this on the back-end, by creating APIs for searching patterns by block: WordPress/pattern-directory#33
The UI flow for how this should work in the editor is very much an open question. This issue is intended as a place to discuss those ideas and figure out a solution.
As an example, when a block is selected in the inserter, there could be a secondary menu or selector that suggests some patterns containing that block. It would probably need to exclude the most common core blocks, since they might appear in almost any pattern. The remote pattern directory might offer some kind of relevancy or ranking to the sort order, to help display only the more useful patterns.
This works now, for patterns that say which blocks they go with.
A pattern can list blocks in blockTypes. When one of those blocks is selected, its Transform menu shows a "Patterns" item with those patterns, and choosing one swaps the block for the pattern (#30469).
Tested on trunk with Twenty Twenty-Four and a plugin pattern, "Product card with Buy now button", with 'blockTypes' => array( 'core/image' ). With an Image block selected, the block's Transform menu suggests it, and choosing it inserts the product card:
Two limits: the pattern has to list the block (patterns are not found just because they contain it), and only blocks without inner blocks get these suggestions. The Pattern Directory side (WordPress/pattern-directory#33) was closed after blockTypes landed there too.
The parent issue #27575 was closed in August as shipped, asking for new focused issues for anything left. Closing this one for the same reason. Please open a focused issue if you need something more.
Activity
mtias commentedon Jan 19, 2021
See also #27575 which discusses surfacing patterns for a given block type, template part area, etc, as transform targets.
annezazu commentedon Mar 3, 2021
Noting this somewhat related issue to make patterns more discoverable: #26116
ellatrix commentedon Nov 4, 2026
This works now, for patterns that say which blocks they go with.
A pattern can list blocks in
blockTypes. When one of those blocks is selected, its Transform menu shows a "Patterns" item with those patterns, and choosing one swaps the block for the pattern (#30469).Tested on trunk with Twenty Twenty-Four and a plugin pattern, "Product card with Buy now button", with
'blockTypes' => array( 'core/image' ). With an Image block selected, the block's Transform menu suggests it, and choosing it inserts the product card:Two limits: the pattern has to list the block (patterns are not found just because they contain it), and only blocks without inner blocks get these suggestions. The Pattern Directory side (WordPress/pattern-directory#33) was closed after
blockTypeslanded there too.The parent issue #27575 was closed in August as shipped, asking for new focused issues for anything left. Closing this one for the same reason. Please open a focused issue if you need something more.
Partly automated with help from Claude.