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.


Top ↑

Parameters

$css string Required
CSS to validate.

Top ↑

Return

true|WP_Error True if the input was validated, otherwise WP_Error.


Top ↑

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;
}


Top ↑

Changelog

Changelog
Version Description
6.2.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.