[wp-trac] [WordPress Trac] #64418: Valid CSS is causing failure in the Additional CSS panel
WordPress Trac
noreply at wordpress.org
Mon Dec 15 18:54:42 UTC 2025
#64418: Valid CSS is causing failure in the Additional CSS panel
--------------------------+---------------------
Reporter: drw158 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 7.0
Component: Customize | Version: 4.7
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: css
--------------------------+---------------------
Comment (by jonsurrell):
@sabernhardt I think this is the correct place for the ticket because this
is Core behavior. There is some CSS validation on the frontend, but it's
disconnected from (and often does not agree with) the logic that actually
accepts or rejects the CSS.
In the case of the site editor, I believe it's the global styles REST
handler that's rejecting here, and [https://github.com/WordPress
/wordpress-develop/blob/eda8d9d27b129ac48143af7d9c2df595dc172e44/src/wp-
includes/rest-api/endpoints/class-wp-rest-global-styles-
controller.php#L659-L679 it appears to have kept the same problematic
regular expression]:
{{{#!php
<?php
function validate_custom_css( $css ) {
if ( preg_match( '#</?\w+#', $css ) ) {
return new WP_Error(
'rest_custom_css_illegal_markup',
__( 'Markup is not allowed in CSS.' ),
array( 'status' => 400 )
);
}
return true;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64418#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list