[wp-trac] [WordPress Trac] #63287: Unexpected output from apply_block_hooks_to_content_from_post_object

WordPress Trac noreply at wordpress.org
Wed Apr 16 10:16:56 UTC 2025


#63287: Unexpected output from apply_block_hooks_to_content_from_post_object
--------------------------+------------------------------
 Reporter:  obenland      |       Owner:  bernhard-reiter
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Editor        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by Bernhard Reiter):

 Right. So the crux is that the block wrapper is needed temporarily to
 allow for first/last child insertion into the Post Content block, as it
 translates between the post's `ignoredHookedBlocks` meta (i.e. reads from
 post meta and sets the corresponding block attribute on the wrapper block,
 and writes back to post meta based on the latter upon writing).

 It's a different story for before/after insertion: If a block is inserted
 before or after the wrapper, it'll confuse
 `remove_serialized_parent_block()`, as @obenland pointed out.

 I'll need to give this a bit more thought to figure out the correct
 solution. My intuition says that before/after insertion should be handled
 one layer higher (e.g. by the template that includes the Post Content
 block). In particular, I don't think that a hooked block inserted
 before/after a Post Content block should be stored inside its
 corresponding post object content. (Instead, it should probably end up
 next to the Post Content block, inside the containing markup.)

 There are however some subtleties that we'll need to think through. For
 one, it raises the question where to store `ignoredHookedBlocks`: Continue
 to use the post meta, or use the containing markup's post content block
 delimiter?

 It will probably also mean that we'll lose the ability to insert before or
 after post content in a non-block theme, but that's probably okay (as we
 wouldn't be dealing with a Post Content block strictly speaking, so
 there's no anchor block before or after which we could insert our hooked
 block).

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


More information about the wp-trac mailing list