[wp-trac] [WordPress Trac] #64544: Core GB backport - individual block custom CSS

WordPress Trac noreply at wordpress.org
Mon Feb 23 15:30:23 UTC 2026


#64544: Core GB backport - individual block custom CSS
---------------------------------------+-----------------------
 Reporter:  glendaviesnz               |       Owner:  ellatrix
     Type:  enhancement                |      Status:  closed
 Priority:  normal                     |   Milestone:  7.0
Component:  General                    |     Version:
 Severity:  normal                     |  Resolution:  fixed
 Keywords:  has-patch gutenberg-merge  |     Focuses:
---------------------------------------+-----------------------

Comment (by jonsurrell):

 @glendaviesnz [61678] re-introduces some behavior around CSS restrictions
 that was improved in [61486] (#64418)
 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/block-
 supports/custom-css.php?rev=61678#L30 (source)]:

 {{{#!php
 <?php
 // Validate CSS doesn't contain HTML markup (same validation as global
 styles REST API).
 if ( preg_match( '#</?\w+#', $custom_css ) ) {
         return $parsed_block;
 }
 }}}

 Restrictions on CSS (`style` tag contents) were relaxed to allow more
 content. It would be nice to maintain that consistency. The previous
 restrictions referred to in the comment were unnecessarily restrictive and
 rejected many safe and valid CSS strings.

 This CSS validation logic is duplicated
 [https://github.com/WordPress/gutenberg/blob/503ba42417e0040e1d4a26bb1a752167a940dfb8/packages
 /block-editor/src/components/global-styles/advanced-panel.js#L17-L30 in
 client-side logic in Gutenberg] that disallows many valid CSS strings.

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


More information about the wp-trac mailing list