Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WP_REST_Global_Styles_Controller::validate_custom_css( string $css ): true|WP_Error
Validate style.css as valid CSS.
Description
Currently just checks for invalid markup.
Parameters
-
$css
string Required -
CSS to validate.
Return
true|WP_Error True if the input was validated, otherwise WP_Error.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
.
View all references
private 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;
}
Changelog
Version | Description |
---|---|
6.2.0 | Introduced. |