W3cubDocs

/WordPress

wp_pre_kses_less_than_callback( string[] $matches ): string

Callback function used by preg_replace.

Parameters

$matchesstring[]required
Populated by matches to preg_replace.

Return

string The text returned after esc_html if needed.

Source

function wp_pre_kses_less_than_callback( $matches ) {
	if ( ! str_contains( $matches[0], '>' ) ) {
		return esc_html( $matches[0] );
	}
	return $matches[0];
}

Changelog

Version Description
2.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_pre_kses_less_than_callback