[wp-trac] [WordPress Trac] #61902: Block Hooks: `"multiple": false` not respected

WordPress Trac noreply at wordpress.org
Wed Aug 21 08:19:31 UTC 2024


#61902: Block Hooks: `"multiple": false` not respected
-----------------------------+-----------------------------
 Reporter:  Bernhard Reiter  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Block Hooks currently do not respect the `"multiple": false` setting: If
 this is set in a prospective hooked block's `block.json`, and there's
 already an instance of that block present in a given context (i.e.
 template, template part, pattern, or navigation menu), then Block Hooks
 should not insert another instance of that block.

 In a similar vein, if no other instance of that block is present in the
 given context, then Block Hooks should insert only one instance of that
 block -- i.e. the first time a matching anchor block is encountered, but
 not for any other matching anchor blocks.

 This will help extenders avoid checking for the presence of another
 instance of their hooked block inside of the `hooked_block_types` filter,
 which is called for every block found in a given context -- thus
 introducing an unnecessary performance overhead.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61902>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list