[wp-trac] [WordPress Trac] #62639: Block Hooks: Wrongly typed context when updating wp_navigation post meta

WordPress Trac noreply at wordpress.org
Wed Dec 4 12:05:49 UTC 2024


#62639: Block Hooks: Wrongly typed context when updating wp_navigation post meta
-----------------------------+------------------------------
 Reporter:  Bernhard Reiter  |       Owner:  Bernhard Reiter
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:  6.7.2
Component:  General          |     Version:  trunk
 Severity:  normal           |  Resolution:  fixed
 Keywords:  has-patch        |     Focuses:
-----------------------------+------------------------------
Changes (by Bernhard Reiter):

 * owner:  (none) => Bernhard Reiter
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59482" 59482]:
 {{{
 #!CommitTicketReference repository="" revision="59482"
 Block Hooks: Fix context in `update_ignored_hooked_blocks_postmeta`.

 Ensure that the `$context` arg passed from
 `update_ignored_hooked_blocks_postmeta` to `apply_block_hooks_to_content`
 (and from there, to filters such as `hooked_block_types` and
 `hooked_block`) has the correct type (`WP_Post`).

 Filters hooked to `hooked_block_types` etc can typically include checks
 that conditionally insert a hooked block depending on `$context`. Prior to
 this changeset, a check like `if ( $context instanceof WP_Post )` would
 incorrectly fail, as `$context` would be a `stdClass` instance rather than
 a `WP_Post`. As a consequence, a hooked block inside of a Navigation post
 object that was modified by the user would not be marked as ignored by
 `update_ignored_hooked_blocks_postmeta`, and thus be erroneosly re-
 inserted by the Block Hooks algorithm.

 Props bernhard-reiter.
 Fixes #62639.
 }}}

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


More information about the wp-trac mailing list