Skip to content

Style Engine: Output numeric style values from server-rendered blocks - #87024

Open
dhruvikpatel18 wants to merge 2 commits into
WordPress:trunkfrom
dhruvikpatel18:fix/style-engine-numeric-values
Open

dhruvikpatel18 wants to merge 2 commits into
WordPress:trunkfrom
dhruvikpatel18:fix/style-engine-numeric-values

Conversation

@dhruvikpatel18

Copy link
Copy Markdown
Member

What?

Closes #87022

Outputs numeric style values, such as "lineHeight":1.5, "fontWeight":300 or "textColumns":2, from server-rendered blocks, as the editor already applies them.

Why?

Since #74881, WP_Style_Engine_CSS_Declarations::add_declaration() drops any value that isn't a string, and #86468 also leaves them out of the declarations returned by wp_style_engine_get_styles(). That keeps malformed array values from causing fatal errors, but it also drops valid numbers. The JS style engine outputs numbers, so the editor shows these styles while the front end silently loses them. The editor's controls save strings, so this mostly affects block markup written by hand or generated by code: theme templates, patterns and plugin output.

Testing Instructions

  1. With a block theme active, create a post, switch to the Code editor and paste:
    <!-- wp:site-title {"style":{"typography":{"lineHeight":1.5,"fontWeight":300}}} /-->
    <!-- wp:site-title {"style":{"typography":{"lineHeight":"1.5","fontWeight":"300"}}} /-->
  2. Switch back to the Visual editor. Both titles are light.
  3. Publish and view the post. Both titles are light, with style="font-weight:300;line-height:1.5". On trunk, the first title has no style attribute.

@dhruvikpatel18 dhruvikpatel18 self-assigned this Nov 18, 2026
@github-actions github-actions Bot added the [Package] Style Engine /packages/style-engine label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dhruvikpatel18 <dhruvik18@git.wordpress.org>
Co-authored-by: mmtr <mmtr86@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

@dhruvikpatel18 dhruvikpatel18 added the [Type] Bug An existing feature does not function as intended label Nov 18, 2026
@dhruvikpatel18
dhruvikpatel18 marked this pull request as ready for review November 19, 2026 05:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Style Engine /packages/style-engine [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Style Engine: numeric style values are dropped from server-rendered blocks but applied in the editor

1 participant