wp_kses_normalize_entities( string $string )

Converts and fixes HTML entities.

Description Description

This function normalizes HTML entities. It will convert AT&T to the correct AT&T, : to :, &#XYZZY; to &#XYZZY; and so on.

Parameters Parameters


(string) (Required) Content to normalize entities

Top ↑

Return Return

(string) Content with normalized entities

Top ↑

Source Source

File: wp-includes/kses.php

function wp_kses_normalize_entities($string) {
	// Disarm all entities by converting & to &
	$string = str_replace('&', '&', $string);

	// Change back the allowed entities in our entity whitelist
	$string = preg_replace_callback('/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string);
	$string = preg_replace_callback('/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string);
	$string = preg_replace_callback('/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string);

	return $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.