wp_kses_split( string $string, array $allowed_html, array $allowed_protocols )

Searches for HTML tags, no matter how malformed.


Description

It also matches stray ">" characters.


Parameters

$string

(string) (Required) Content to filter

$allowed_html

(array) (Required) Allowed HTML elements

$allowed_protocols

(array) (Required) Allowed protocols to keep


Return

(string) Content with fixed HTML tags


Source

File: wp-includes/kses.php

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


Changelog

Changelog
Version Description
WP-1.0.0 Introduced.