[wp-trac] [WordPress Trac] #54975: Allow filtering global styles

WordPress Trac noreply at wordpress.org
Thu Mar 2 08:43:40 UTC 2023


#54975: Allow filtering global styles
--------------------------+------------------------------
 Reporter:  webmandesign  |       Owner:  (none)
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Editor        |     Version:  5.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  css
--------------------------+------------------------------

Comment (by webmandesign):

 Hi,

 After a year, I'm building a block theme (actually a "hybrid" theme) and
 still came up with a usecase where I would really appreciate a filter for
 the actual CSS data passed to `global-styles` handle. It would really be
 nice if we could filter the
 [https://github.com/WordPress/WordPress/blob/6.1.1/wp-includes/script-
 loader.php#L2441 `$stylesheet` variable passed as an inline data for
 `global-styles` handle].

 The usecase is not the same as the original issue here, but the request
 remains the same as you can see.

 If I'm not mistaken, there is currently no way for a theme developer to
 change where WordPress registers/sets its CSS properties. Currently this
 is done on `body` HTML selector. I'd like to use `:root` instead.

 I understand this need to stay intact in core WordPress due to editor
 styles where `body` is being replaced with `.editor-styles-wrapper`, but
 please, at least allow theme and plugin developers to filter the data if
 needed.

 `body` seems to be unnecessarily too high of a specificity to register CSS
 properties, at least on front-end of the website.

 Thanks for consideration.

 re: @oandregal

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54975#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list