[wp-trac] [WordPress Trac] #64695: Global Styles: Support css feature selector for block custom CSS

WordPress Trac noreply at wordpress.org
Mon Feb 23 01:03:55 UTC 2026


#64695: Global Styles: Support css feature selector for block custom CSS
-----------------------------+--------------------
 Reporter:  aaronrobertshaw  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  7.1
Component:  Editor           |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+--------------------
 This ticket tracks the backport of PHP changes from the following
 Gutenberg PR:

 https://github.com/WordPress/gutenberg/pull/75799

 When a block type defines a `css` feature selector in its `selectors`
 config, Global Styles custom CSS output (the per-block "Additional CSS"
 field) should honor that selector rather than always using the block's
 root selector.

 Currently, the Global Styles system respects feature-specific selectors
 for standard style properties like `border`, `color`, and `typography`,
 but custom CSS always falls back to the root selector. This change brings
 custom CSS in line with the existing behavior for other style features.

 The PHP changes cover two methods in `WP_Theme_JSON`:

 1. `get_styles_for_block()` — When processing custom CSS rules, check for
 a `css` feature selector before falling back to the block's root selector.
 2. `get_feature_declarations_for_node()` — Skip the `css` key when
 iterating over feature selectors to prevent it being consumed as a regular
 style property.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64695>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list