Opened 20 months ago
Closed 20 months 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 |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.7.2 |
| Component: | General | Version: | 6.9 |
| Severity: | normal | Keywords: | has-patch fixed-major dev-reviewed |
| Cc: | Focuses: |
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.
20 months ago
#1
- Keywords has-patch added
#2
follow-up:
↓ 5
@
20 months ago
Noting that the bug is present in 6.7.x, but not in 6.6.x. It was caused by [58578].
@Bernhard Reiter commented on PR #7941:
20 months ago
#4
Committed to Core trunk in https://core.trac.wordpress.org/ticket/62639.
#5
in reply to: ↑ 2
@
20 months ago
- Keywords fixed-major dev-feedback added
- Resolution fixed
- Status closed → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Discovered while working on #7898. Details to follow.
Trac ticket: https://core.trac.wordpress.org/ticket/62639