Opened 8 weeks ago
Closed 7 weeks ago
#62639 closed defect (bug) (fixed)
Block Hooks: Wrongly typed context when updating wp_navigation post meta
Reported by: | Bernhard Reiter | Owned by: | Bernhard Reiter |
---|---|---|---|
Milestone: | 6.7.2 | Priority: | normal |
Severity: | normal | Version: | trunk |
Component: | General | Keywords: | has-patch fixed-major dev-reviewed |
Focuses: | Cc: |
Description
update_ignored_hooked_blocks_postmeta
passes a $context
argument to apply_block_hooks_to_content
that is used by the hooked_block_types
, hooked_block
, and hooked_block_{$hooked_block_type}
filters, if any.
Those filters allow extenders to conditionally insert hooked blocks, based on criteria that might involve the $context
argument. For example, a filter might check if ( $context instanceof WP_Post && 'wp_navigation' === $context->post_type )
to limit insertion of a hooked block to Navigation blocks only.
While other functions that also call apply_block_hooks_to_content
pass a correctly typed $context
, update_ignored_hooked_blocks_postmeta
passes a stdObject
rather than a WP_Post
instance. As a result, a criterion like in the above filter example will fail -- thus not correctly setting ignoredHookedBlocks
metadata for the wp_navigation
post object in question.
Change History (7)
This ticket was mentioned in PR #7941 on WordPress/wordpress-develop by @Bernhard Reiter.
8 weeks ago
#1
- Keywords has-patch added
#2
follow-up:
↓ 5
@
7 weeks ago
Noting that the bug is present in 6.7.x, but not in 6.6.x. It was caused by [58578].
#3
@
7 weeks ago
- Owner set to Bernhard Reiter
- Resolution set to fixed
- Status changed from new to closed
In 59482:
@Bernhard Reiter commented on PR #7941:
7 weeks ago
#4
Committed to Core trunk
in https://core.trac.wordpress.org/ticket/62639.
#5
in reply to:
↑ 2
@
7 weeks ago
- Keywords fixed-major dev-feedback added
- Resolution fixed deleted
- Status changed from closed to reopened
Replying to Bernhard Reiter:
Noting that the bug is present in 6.7.x, but not in 6.6.x. It was caused by [58578].
Reopening to solicit approval by another Core Committer for backporting to the 6.7 branch.
Discovered while working on #7898. Details to follow.
Trac ticket: https://core.trac.wordpress.org/ticket/62639