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

Searches for HTML tags, no matter how malformed.

Description Description

It also matches stray > characters.

Parameters Parameters


(string) (Required) Content to filter.


(array) (Required) Allowed HTML elements.


(string[]) (Required) Array of allowed URL protocols.

Top ↑

Return Return

(string) Content with fixed HTML tags

Top ↑

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

Top ↑

Changelog Changelog

Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.