wp_pre_kses_less_than() WordPress Function

The wp_pre_kses_less_than() function is a pre-save filter used to remove the less than (<) character from the content before it is saved to the database. This is done to prevent accidental insertion of HTML code that could break the site.

wp_pre_kses_less_than( string $text ) #

Converts lone less than signs.


Description

KSES already converts lone greater than signs.


Top ↑

Parameters

$text

(string)(Required)Text to be converted.


Top ↑

Return

(string) Converted text.


Top ↑

Source

File: wp-includes/formatting.php

function wp_pre_kses_less_than( $text ) {
	return preg_replace_callback( '%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text );
}


Top ↑

Changelog

Changelog
VersionDescription
2.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More