[wp-trac] [WordPress Trac] #59669: Block: Give `traverse_and_serialize_block(s)`' post-callback access to block instance

WordPress Trac noreply at wordpress.org
Wed Oct 18 19:28:26 UTC 2023


#59669: Block: Give `traverse_and_serialize_block(s)`' post-callback access to
block instance
--------------------------------------+------------------------------
 Reporter:  Bernhard Reiter           |       Owner:  Bernhard Reiter
     Type:  enhancement               |      Status:  assigned
 Priority:  normal                    |   Milestone:  6.5
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------
Description changed by Bernhard Reiter:

Old description:

> Both the `$pre_` and `$post_callback` functions that are given as
> arguments to `traverse_and_serialize_block(s)` receive a reference to the
> current block as its first argument. However, while any changes that the
> "pre" callback makes to the block are actually respected during
> serialization, the same isn't true for the "post" callback: Any changes
> that it makes are only applied after the block has already been
> serialized. For applications like #59412, we probably want to change
> that.

New description:

 Both the `$pre_` and `$post_callback` functions that are given as
 arguments to `traverse_and_serialize_block(s)` receive a reference to the
 current block as their first argument. However, while any changes that the
 "pre" callback makes to the block are actually respected during
 serialization, the same isn't true for the "post" callback: Any changes
 that it makes are only applied after the block has already been
 serialized. For applications like #59646, we probably want to change that.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59669#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list