On this page
wp_kses_split( string $string, array[]|string $allowed_html, string[] $allowed_protocols ): string
Searches for HTML tags, no matter how malformed.
Description
It also matches stray > characters.
Parameters
$stringstring Required-
Content to filter.
$allowed_htmlarray[]|string Required-
An array of allowed HTML elements and attributes, or a context name such as
'post'. See wp_kses_allowed_html() for the list of accepted context names. $allowed_protocolsstring[] Required-
Array of allowed URL protocols.
Return
string Content with fixed HTML tags
Source
File: wp-includes/kses.php. View all references
function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
global $pass_allowed_html, $pass_allowed_protocols;
$pass_allowed_html = $allowed_html;
$pass_allowed_protocols = $allowed_protocols;
return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string );
}
Related
Used By
| Used By | Description |
|---|---|
| wp_kses() wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_kses_split