WP_Customize_Custom_CSS_Setting::validate( string $css )
Validate CSS.
Description
Checks for imbalanced braces, brackets, and comments. Notifications are rendered when the customizer state is saved.
Parameters
- $css
-
(string) (Required) The input string.
Return
(true|WP_Error) True if the input was validated, otherwise WP_Error.
Source
File: wp-includes/customize/class-wp-customize-custom-css-setting.php
public function validate( $css ) { $validity = new WP_Error(); if ( preg_match( '#</?\w+#', $css ) ) { $validity->add( 'illegal_markup', __( 'Markup is not allowed in CSS.' ) ); } if ( ! $validity->has_errors() ) { $validity = parent::validate( $css ); } return $validity; }
Changelog
Version | Description |
---|---|
4.9.0 | Checking for balanced characters has been moved client-side via linting in code editor. |
4.7.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_custom_css_setting/validate