Block Hooks: Fix duplicated insertion in Post Content #69142
Merged
+47
−41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
In the editor, hooked blocks are currently inserted twice into post content (when using the GB plugin on a WP
trunk
install).This was likely introduced by #67272 and its Core counterpart,
[59523]
. It was probably not discovered earlier as it requires testing GB against Coretrunk
.Likely also affects Synced Patterns (#68058 and
[59543]
), which are also fixed by this PR.Discovered while working on #69044, which is adding e2e test coverage for this exact scenario (and others).
Why?
It's a bug 🤷♂️
How?
By removing the
insert_hooked_blocks_into_rest_response
filter before adding GB's own version,gutenberg_insert_hooked_blocks_into_rest_response
.Testing Instructions
This is covered by end-to-end tests introduced by #69044. Follow that PR's instructions to run tests locally, and cherry-pick the commit from this PR on top to verify that it fixes the issue.