Title: WP_Http_Cookie::get_attributes
Published: August 16, 2016
Last modified: April 28, 2025

---

# WP_Http_Cookie::get_attributes(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_http_cookie/get_attributes/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_http_cookie/get_attributes/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_http_cookie/get_attributes/?output_format=md#changelog)

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

Retrieves cookie attributes.

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

 array List of attributes.

 * `expires` string|int|null
 * When the cookie expires. Unix timestamp or formatted date.
 * `path` string
 * Cookie URL path.
 * `domain` string
 * Cookie domain.

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

    ```php
    public function get_attributes() {
    	return array(
    		'expires' => $this->expires,
    		'path'    => $this->path,
    		'domain'  => $this->domain,
    	);
    }
    ```

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

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

| Version | Description | 
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |

## User Contributed Notes

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