Repository navigation
Block Supports: Add a PHP helper that returns every support's classes and styles - #86337
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 8.62 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Page List converts to Navigation Links with entity bindings in
|
808e402 to
00c1833
Compare
… and styles Combines the background, color, border, shadow and spacing helpers in the style engine's order. An optional list limits it to the supports a block applies to one element. Avatar and Post Navigation Link now use it.
6041354 to
931f00c
Compare
|
Appreciate the reviews and testing here folks. Thank you. I'll look to get this merged. |

Core backport: WordPress/wordpress-develop#15485
Related:
What?
Adds one PHP helper that returns the classes and styles of every support that has a helper: background, color, border, shadow and spacing.
Blocks call it as
wp_get_block_supports_classes_and_styles(). Avatar and Post Navigation Link now use it.Why?
A block that skips serialization for several supports calls one helper per support, then joins the results by hand. Every such block repeats that code and must get the order right.
How?
The helper calls the five support helpers in the style engine's order and removes duplicate classes. It doesn't check block support or skipped serialization.
The optional second argument limits which supports it includes. Both blocks need it, because they apply other supports to another element.
wp_get_block_supports_classes_and_stylesjoinsprefixFunctions.Blocks left as they are
has-backgroundand has its own color handlingTesting Instructions
Nothing visible changes, so there are no screenshots.
On Twenty Twenty-Five, 45 renders of Avatar and Post Navigation Link match trunk byte for byte.
To check by hand:
Use of AI Tools
Implemented and tested with Claude Code.