wppaste
WordPress

convert_invalid_entities( string $content ): string

Since
4.3.0
Source
wp-includes/formatting.php:2511
Converts invalid Unicode references range to valid range.

Parameters

$contentstring
String with entities that need converting.

Return

string
Converted string.

Uses · 1

  • str_contains()Polyfill for `str_contains()` function added in PHP 8.0.

Source

function convert_invalid_entities( $content ) {	$wp_htmltranswinuni = array(		'€' => '€', // The Euro sign.		'' => '',		'‚' => '‚', // These are Windows CP1252 specific characters.		'ƒ' => 'ƒ',  // They would look weird on non-Windows browsers.		'„' => '„',		'…' => '…',		'†' => '†',		'‡' => '‡',		'ˆ' => 'ˆ',		'‰' => '‰',		'Š' => 'Š',		'‹' => '‹',		'Œ' => 'Œ',		'' => '',		'Ž' => 'Ž',		'' => '',		'' => '',		'‘' => '‘',		'’' => '’',		'“' => '“',		'”' => '”',		'•' => '•',		'–' => '–',		'—' => '—',		'˜' => '˜',		'™' => '™',		'š' => 'š',		'›' => '›',		'œ' => 'œ',		'' => '',		'ž' => 'ž',		'Ÿ' => 'Ÿ',	); 	if ( str_contains( $content, '&#1' ) ) {		$content = strtr( $content, $wp_htmltranswinuni );	} 	return $content;}

History

Introduced in 4.3.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/formatting.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.