A WordPress-centric search engine for devs and theme authors



wp_kses_split ›

Since1.0.0
Deprecatedn/a
wp_kses_split ( $string, $allowed_html, $allowed_protocols )
Parameters: (3)
  • (string) $string Content to filter
    Required: Yes
  • (array) $allowed_html Allowed HTML elements
    Required: Yes
  • (array) $allowed_protocols Allowed protocols to keep
    Required: Yes
Returns:
  • (string) Content with fixed HTML tags
Defined at:
Codex:

Searches for HTML tags, no matter how malformed.

It also matches stray ">" characters.



Source

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