Title: WP_REST_Request::get_attributes
Published: December 9, 2015
Last modified: April 28, 2025

---

# WP_REST_Request::get_attributes(): array

## In this article

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

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

Retrieves the attributes for the request.

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

These are the options for the route that was matched.

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

 array Attributes for the request.

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

    ```php
    public function get_attributes() {
    	return $this->attributes;
    }
    ```

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

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

| Used by | Description | 
| [WP_REST_Request::sanitize_params()](https://developer.wordpress.org/reference/classes/wp_rest_request/sanitize_params/)`wp-includes/rest-api/class-wp-rest-request.php` |

Sanitizes (where possible) the params on the request.

  | 
| [WP_REST_Request::has_valid_params()](https://developer.wordpress.org/reference/classes/wp_rest_request/has_valid_params/)`wp-includes/rest-api/class-wp-rest-request.php` |

Checks whether this request is valid according to its attributes.

  |

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

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

## User Contributed Notes

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