[wp-trac] [WordPress Trac] #59327: Add optional callback argument to serialize_block(s)

WordPress Trac noreply at wordpress.org
Mon Sep 11 16:53:16 UTC 2023


#59327: Add optional callback argument to serialize_block(s)
-----------------------------+-----------------------------
 Reporter:  Bernhard Reiter  |      Owner:  Bernhard Reiter
     Type:  enhancement      |     Status:  assigned
 Priority:  normal           |  Milestone:  6.4
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 For some operations, we need to traverse the parsed block tree (before it
 is eventually serialized). In order to minimize the number of tree
 traversals (which is a potentially costly operation), it seems that adding
 a callback function argument to `serialize_block()` -- which inevitably
 has to traverse the entire tree anyway -- is a natural fit.

 Examples where this will come in handy:
 - `theme` arg injection into a block template loaded from a file.
 - Automatic insertion of hooked blocks (see #59313).

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


More information about the wp-trac mailing list