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.


Top ↑

Parameters

$string

(string)(Required)


Top ↑

Return

(string)


Top ↑

Source

File: wp-includes/kses.php

function wp_kses_html_error( $string ) {
	return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string );
}


Top ↑

Changelog

Changelog
VersionDescription
1.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.