WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp specialchars

Contents

Description

This function is deprecated as of WordPress 2.8.0. Please use esc_html instead.

Converts a number of special characters into their HTML entities.

Differs from htmlspecialchars as existing HTML entities will not be encoded. Specifically changes: & to &#038;, < to &lt; and > to &gt;.

$quotes can be set to 'single' to encode ' to &#039;, 'double' to encode " to &quot;, or '1' to do both. Default is 0 where no quotes are encoded.

Usage

<?php wp_specialchars$text$quotes ?>

Parameters

$text
(string) (required) The text which is to be encoded.
Default: None
$quotes
(mixed) (optional) Converts single quotes if set to 'single', double if set to 'double' or both if otherwise set.
Default: 0

Return Values

(string) 
The encoded text with HTML entities.

Examples

Notes

Change Log

Since: 1.2.2

Source File

wp_specialchars() is located in wp-includes/formatting.php.

Related

See also index of Function Reference and index of Template Tags.