_wp_specialchars ( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false )

  • private
  • (string) $string The text which is to be encoded.
  • (int|string) $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
  • (false|string) $charset Optional. The character encoding of the string. Default is false.
  • (bool) $double_encode Optional. Whether to encode existing html entities. Default is false.
  • (string) The encoded text with HTML entities.
Defined at:


Converts a number of special characters into their HTML entities.

Specifically deals with: &, <, >, ", and '.

$quote_style can be set to ENT_COMPAT to encode " to ", or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.

Related Functions

wp_specialchars, wp_specialchars_decode, wp_cache_reset, _canonical_charset, wp_get_nocache_headers

Top Google Results

User discussions

wpseek mobile