Codex

Function Reference/attribute escape

← Return to function reference.


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php.

Contents

Description

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

This function escapes or encodes HTML special characters (including single and double quotes) for use in HTML attriutes. It works like the standard PHP htmlspecialchars except that it doesn't double-encode HTML entities (i.e. & will remain unchanged, rather than encoded to &).

attribute_escape can be found in /wp-includes/formatting.php.

Usage

<?php echo attribute_escape($text); ?>

Parameters

$text
(string) Text to be escaped.

Related

esc_attr, esc_attr_e.