wp_kses_html_error() WordPress Function
The wp_kses_html_error() function is used to return an error message when a user tries to post invalid HTML to a WordPress site. This function can be used to help prevent XSS attacks by preventing users from posting malicious code to your site.
wp_kses_html_error( string $string ) #
Handles parsing errors in wp_kses_hair()
.
Description
The general plan is to remove everything to and including some whitespace, but it deals with quotes and apostrophes as well.
Parameters
- $string
(string)(Required)
Return
(string)
Source
File: wp-includes/kses.php
function wp_kses_html_error( $string ) { return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |