Skip to content

Open up "Pattern Overrides" and therefore intern block bindings to custom dynamic blocks #64870

Closed

Description

@fabiankaegy

This issue is coming out of a discussion in the Make WordPress Slack Outreach Channel where we discussed some of the reasons why we are not ready to adopt pattern overrides on custom build projects.

Currently, pattern overrides is limited to only a small set of core blocks that have handling for their block bindings HTML replacement handled manually. With that, we have opted not to expose the mechanisms to create blocks that make use of the Pattern Overrides feature publicly until the HTML API lands in core.

However, we just realized that this limitation to wait on the HTML API only really applies to static blocks (ones that serialize their HTML to the database). For dynamic blocks (block rendered via a render_callback in PHP) this limitation does not exist.

Because of that I would propose that we open up the block bindings / pattern overrides feature for custom blocks that use dynamic rendering.

How to achieve that:

First we would need to find a way to indicate which attributes of which blocks actually allow to be bound to something. Currently, this is managed in a hard-coded list. #64756 explores adding a bindable decorator to the attributes definition which could be used to get that list dynamically.

Once we know which attributes of which blocks support bindings, we would need to also use that to handle saving attributes / passing in the correct value of attributes correctly in the editor.

And finally, we can use that same bindable key to replace https://github.com/WordPress/wordpress-develop/blob/e569967ee45e23186f6aa7f479fcb48a7511436b/src/wp-includes/class-wp-block.php#L246-L251 with the dynamic lookup of supported bindings.

Activity

  1. added
    [Type] Enhancement
    [Feature] Block API
    on Aug 28, 2024
  2. changed the title [-]Open up "Pattern Overrides" and therefore intern block bindings to custom **dynamic** blocks[/-] [+]Open up "Pattern Overrides" and therefore intern block bindings to custom dynamic blocks[/+] on Aug 28, 2024
  3. fabiankaegy commented on Aug 28, 2024

    @fabiankaegy
    MemberAuthor

    CC: @gziolo @SantosGuillamot since you participated in the conversation in slack :) Would love to get your take on whether I captured things correctly here and to fill in all the nuances that I am missing

  4. moved this to 🗣️ In Discussion / Needs Decision in WordPress 6.7 Editor Taskson Aug 28, 2024
  5. bph commented on Aug 28, 2024

    @bph
    Contributor

    Also pinging the outreach group @WordPress/outreach to chime in especially on use cases and further thoughts.

  6. added
    [Focus] Blocks Adoption
    [Feature] Extensibility
    on Aug 28, 2024
  7. fabiankaegy commented on Aug 28, 2024

    @fabiankaegy
    MemberAuthor

    I can chime in and provide some use case examples also :)

    First of all, pretty much all blocks we built on custom sites are dynamic block. The reason for this is mostly due to design flexibility with continually changing design requirements.

    Some examples of these custom blocks we have on pretty much every project:

    1. Post Picker block
      We have a post picker block that works similar to the post template of the core query. So you can use any of the post level blocks within that block to manage your layout. But instead of being defined by a query, the user can manually search for any articles on their site and reference it. Under the hood all we store in the blocks attributes are the postId and postType.
      It would be super valuable to be able to use this post picker in a synced pattern and then enable overrides so that a user is still able to change the post that gets displayed (this happens via the blocks toolbar and already is setup to work in content only locking)

    2. Icon block
      Similar to the above example we have an Icon block. This icon block allows the user to pick from a predefined set of icons that we bundle with the theme. All we store is the name of the icon.

    It would be great be to able to use that inside a synced pattern and enable overrides so that the user can still change the actual icon that should be used whilst all the design options of how large, what color, etc the icon is are still synced.


    The end goal that would the make this feature soooooo much more powerful is to allow for all of this in Synced Theme Patterns (#59272)

  8. added
    [Feature] Synced Patterns
    on Sep 9, 2024
  9. colorful-tones commented on Sep 10, 2024

    @colorful-tones
    Member

    I can certainly see how this would be useful. Having the allowed blocks hard-coded is not ideal.

    I am confused by

    limitation to wait on the HTML API

    I thought the HTML API was stable and released back in WP 6.2? 😕

  10. gziolo commented on Sep 10, 2024

    @gziolo
    Member

    I am confused by

    limitation to wait on the HTML API

    I thought the HTML API was stable and released back in WP 6.2? 😕

    That was HTML Tag Processor in WP 6.2. We are talking about HTML Processor and two features it will allow to support - setInnerHTML method and the ability to convert schema defined by block attributes into the query that should find the proper location in the instance of HTML API:

    "href": {
    "type": "string",
    "source": "attribute",
    "selector": "figure > a",
    "attribute": "href",
    "__experimentalRole": "content"
    },

    Which would be equivalent to JavaScript:

    document.querySelector( 'figure > a' ).href = 'new value';

    "caption": {
    "type": "rich-text",
    "source": "rich-text",
    "selector": "figcaption",
    "__experimentalRole": "content"
    },

    Which would be equivalent to JavaScript:

    document.querySelector( 'figcaption' ).innerHTML = '<strong>new value</strong>';
  11. mtias commented on Sep 11, 2024

    @mtias
    Member

    One addendum on the point of role: 'content'—it's not really about serializing static content but about signaling what part of the block should be considered user content so it can be kept while transformed into another block (as part of a larger pattern; without having to know to / from attribute mapping), swapped with another source (bindings), surfaced in content-only scenarios while other roles are discarded, etc.

    I'd really like to focus on the semantics of the role and avoid introducing decorator flags like "bindable". The ideal state of this setup is that the role of an attribute signals everything necessary for augmentation.

    This will be an important aspect of multilingual as well. The attributes designated as "content" would be the immediate candidates for localization.

    The more this is architected around the topology of the role itself and less about operational flags the more it simplifies adoption and the overall clarity for extenders. It's a do more with less kind of thing.

  12. 15 remaining items

  13. gziolo commented on Sep 23, 2025

    @gziolo
    Member

    this was review as part 6.9 bug scrub. Will this be picked up for 6.9?

    @ockham is actively working on a task that potentially allows filtering on the server of the list of block attributes with Block Bindings support in a way that gets reflected on the client. Once it's implemented and consolidated with Pattern Overrides, then we potentially could have this functionality ready. However, it's still in the exploration phase, so we need a few more days before we can make the final decision. Related PR:

  14. ockham commented on Sep 23, 2025

    @ockham
    Contributor

    👋 Here's the GB counterpart PR: #71820 (which is even more important, since that's what's needed to pick up the server list on the client side). Still WIP 😄

  15. ryanwelcher commented on Sep 29, 2025

    @ryanwelcher
    Contributor

    Reviewed in the scrub today. There seems to be forward momentum.

  16. t-hamano commented on Oct 13, 2025

    @t-hamano
    Contributor

    This issue was featured on today's Bug Scrub. It looks like #71820 has been merged, but can we move this issue forward?

  17. gziolo commented on Oct 13, 2025

    @gziolo
    Member

    @ockham might know best, but my understanding is that it still needs some refactors because Pattern Overrides on the client maintain their own allow list for block types and its attributes, and some planned tasks for Block Bindings in WP 6.9 will fix it. We will also need to add e2e test covering it so we can satisfy the promise before advertising it to the larger audience.

  18. t-hamano commented on Oct 20, 2025

    @t-hamano
    Contributor

    This issue was featured on today's Bug Scrub. Should we punt this ticket to 7.0?

  19. t-hamano commented on Oct 21, 2025

    @t-hamano
    Contributor

    Since 6.9 Beta1 is just around the corner, I'd like to punt this issue to 7.0. Please let me know if I've missed anything.

  20. moved this from ❓ Triage to 🦵 Punted to 7.0 in WordPress 6.9 Editor Taskson Oct 21, 2025
  21. cbravobernal commented on Oct 21, 2025

    @cbravobernal
    Contributor

    Thanks @t-hamano and sorry for not answering at time. Yes, let's punt it, as still requires some work to do.
    We need to review it as now there is a filter to add more support for block attributes.

  22. ockham commented on Oct 21, 2025

    @ockham
    Contributor

    What Carlos said. FWIW, we came close to landing a solution that would have used the list of blocks that are supported by block bindings as provided by the server to determine if a block supports pattern overrides. However, we realized that these two things aren't entirely identical -- notable exceptions being the Navigation Link and Navigation Submenu blocks, which as of 6.9 will support Block Bindings -- but would conflict with Pattern Overrides. We decided that we'd need to keep the lists separate after all, and will look into an extensibility mechanism for Pattern Overrides for 7.0.

  23. added
    [Status] In Progress
    on Dec 10, 2025
  24. moved this from 🦵 Punted to 7.0 to ✅ Done in WordPress 6.9 Editor Taskson Jan 6, 2026
  25. removed
    [Status] In Progress
    on Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Block API[Feature] Block bindings[Feature] Extensibility[Feature] Synced Patterns[Focus] Blocks Adoption[Type] Enhancement

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions