Repository navigation
Preserve valid empty and zero values from block bindings - #127
Merged
Merged
Conversation
alecgeatches
previously approved these changes
Nov 19, 2026
alecgeatches
left a comment
Contributor
There was a problem hiding this comment.
Minor comment suggestion, otherwise good to go!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
When a block binding returns an empty string, zero, false, or a value equal to the attribute default, the parser can mistake that valid result for a missing binding and overwrite it with saved HTML.
For example, clearing a field used by
core/post-metacan leave REST and GraphQL returning the old text saved in the block instead of the empty value.Track attributes successfully resolved by WordPress during rendering and preserve those values during extraction. Follow core’s behavior of treating only
nullas unresolved, without calling binding sources again.This also covers synced-pattern children. Temporary observers are removed when rendering throws. Screenshots are not applicable to this API change.
Steps to Test
Run against WordPress 6.8, 6.9 and 7.1:
composer phpcs composer test composer test-multisiteRegression tests cover valid binding values, fallback behavior, synced patterns, filtered values, source-call counts and cleanup after exceptions.