Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#54953 closed defect (bug) (reported-upstream)

Custom css variables in theme.json have different keys in 5.9

Reported by: walbo's profile walbo Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.9
Component: Themes Keywords:
Focuses: Cc:


Noticed that custom css variables generated by theme.json can have different output in WP5.9 compared to how they were in 5.8. Seems like 5.9 adds an extra - when numbers are included in the key.

  "settings": {
    "custom": {
      "m16": "1rem"

The example above will in 5.8 create a variable called: --wp--custom--m16 but in 5.9 it will be --wp--custom--m-16.

I'm not sure if the change was a bug fix or unintended change. We have a plugin that allows themes to change som style using custom variables and this bug makes it hard to support both 5.8 and 5.9

Change History (9)

#1 @SergeyBiryukov
2 years ago

  • Component changed from General to Themes

This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.

2 years ago

#3 @Clorith
2 years ago

  • Milestone changed from Awaiting Review to 5.9.2

Upstream report to the Gutenberg repo at

Adding to the 5.9.2 milestone for tracking until we have a clear direction here.

#4 @oandregal
2 years ago

WordPress 5.8 had a bug by which front-end styles and editor styles were different. We fixed this in 5.9. See more details at

The plan is to update the devnote for theme.json v2 including this bugfix

#5 @oandregal
2 years ago

As reported upstream the devnote has been updated and this is the correct behavior.

#6 @oandregal
2 years ago

I'm unable to close the issue. I can mark it as "wontfix" or "worksforme" labels but that feels wrong. Sharing in case anyone can close it.

#7 @audrasjb
2 years ago

  • Milestone changed from 5.9.2 to 5.9.3

Moving to milestone 5.9.3 since we're about to release 5.9.2.

#8 @davidbaumwald
2 years ago

  • Milestone 5.9.3 deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

#9 @joyously
2 years ago

#55602 was marked as a duplicate.

Note: See TracTickets for help on using tickets.