WPDev.one
Core Function
View Source on Trac ↗

_wp_specialchars()

_wp_specialchars( mixed $text, mixed $quote_style = ENT_NOQUOTES, mixed $charset = false, mixed $double_encode = false )

Converts a number of special characters into their HTML entities.

Parameters 3 required

Name / Type Description
$text
string

The text which is to be encoded.

Required
mixed

(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. Converts single and double quotes, as well as converting HTML named entities (that are not also XML named entities) to their code points if set to ENT_XML1. 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.

Required
(false

| string) $charset Optional. The character encoding of the string. Default false.

Required
$double_encode
bool

Optional. Whether to encode existing HTML entities. Default false.

Return Value

(string)
The encoded text with HTML entities.

Function Information

Since Version
1.2.2
Source File
wp-includes/formatting.php
Advertisement