Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren

wp_kses_split ›

wp_kses_split ( $string, $allowed_html, $allowed_protocols )
Parameter: (3)
  • (string) $string Content to filter.
    Erforderlich: Ja
  • (array[]|string) $allowed_html 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.
    Erforderlich: Ja
  • (string[]) $allowed_protocols Array of allowed URL protocols.
    Erforderlich: Ja
Gibt zurück:
  • (string) Content with fixed HTML tags
Definiert in:

Searches for HTML tags, no matter how malformed.

It also matches stray > characters.


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