Title: attribute_escape
Published: April 25, 2014
Last modified: April 28, 2025

---

# attribute_escape( string $text ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#wp--skip-link--target)

This function has been deprecated since 2.8.0. Use [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)
instead.

Escaping for HTML attributes.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#see-also)󠁿

 * [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#parameters)󠁿

 `$text`stringrequired

## 󠀁[Return](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#return)󠁿

 string

## 󠀁[Source](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#source)󠁿

    ```php
    function attribute_escape( $text ) {
    	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' );
    	return esc_attr( $text );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/deprecated.php#L2100)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/deprecated.php#L2100-L2103)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#related)󠁿

| Uses | Description | 
| [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` |

Escaping for HTML attributes.

  | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/attribute_escape/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Deprecated. Use [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)  | 
| [2.0.6](https://developer.wordpress.org/reference/since/2.0.6/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fattribute_escape%2F)
before being able to contribute a note or feedback.