Background image support: Fix duplicate output of styling rules #56997
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?
Part of #54336
Fix duplicate output of background image styling rules for the Group block.
Why?
As of WP 6.4, the background image block support exists in core as well as in the Gutenberg plugin. Unlike the other block supports, in Gutenberg, we were missing the
remove_filter
line to switch off the core behaviour if present, to prioritise the Gutenberg behaviour and allow further development of the block support within the plugin.How?
remove_filter
line to disable core's callback for the background support if presentTesting Instructions
Test with WP 6.4+
Prior to applying this PR, add a post or page with a Group block and set a background image for it. Save and view the site frontend, and inspect the generated markup — notice that the
background-image
andbackground-size:cover
rules are duplicated.With this PR applied, there should only be one
background-image
andbackground-size:cover
rule in the generated markup.Screenshots or screencast
Before
After