Skip to content

Patterns should be discoverable from block editor #28309

Closed

Description

@tellyworth

What problem does this address?

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.

Activity

  1. added
    [Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced
    on Jan 18, 2021
  2. mtias commented on Jan 19, 2021

    @mtias
    Member

    See also #27575 which discusses surfacing patterns for a given block type, template part area, etc, as transform targets.

  3. annezazu commented on Mar 3, 2021

    @annezazu
    Contributor

    Noting this somewhat related issue to make patterns more discoverable: #26116

  4. ellatrix commented on Nov 4, 2026

    @ellatrix
    Member

    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:

    Transform menu suggests the pattern
    After choosing it
    Code editor

    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.

    Partly automated with help from Claude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Pattern DirectoryThe Pattern Directory, a place to find patterns[Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions