Core Class
View Source on Trac ↗
Core Class
WP_REST_Response
class WP_REST_Response
// Constructor: function Object() { [native code] } Core class used to implement a REST response object.
Methods 12 methods
| Method / Return | Description |
|---|---|
| add_link() void | Adds a link to the response.
Parameters: $rel: mixed, $href: mixed, $attributes: mixed |
| remove_link() void | Removes a link from the response.
Parameters: $rel: mixed, $href: mixed |
| add_links() void | Adds multiple links to the response.
Parameters: $links: mixed |
| get_links() array | Retrieves links for the response. |
| link_header() void | Sets a single link header.
Parameters: $rel: mixed, $link: mixed, $other: mixed |
| get_matched_route() string | Retrieves the route that was used. |
| set_matched_route() void | Sets the route (regex for path) that caused the response.
Parameters: $route: mixed |
| get_matched_handler() (null | Retrieves the handler that was used to generate the response. |
| set_matched_handler() void | Sets the handler that was responsible for generating the response.
Parameters: $handler: mixed |
| is_error() bool | Checks if the response is an error, i.e. >= 400 response code. |
| as_error() (WP_Error | Retrieves a WP_Error object from the response. |
| get_curies() array | Retrieves the CURIEs (compact URIs) used for relations. |
Properties
| Property / Type | Description |
|---|---|
| $links mixed public | No description available. |
| $matched_route mixed public | No description available. |
| $matched_handler mixed public | No description available. |
Class Information
Since Version
4.4.0
Source File
wp-includes/rest-api/class-wp-rest-response.php
Advertisement