WP_REST_Response
- Since
- 4.4.0
- Source
wp-includes/rest-api/class-wp-rest-response.php:17
Core class used to implement a REST response object.
Compatibility
- WordPress
- since 4.4.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 1
Every hook that fires from inside WP_REST_Response, in the order it appears in the class, grouped by the method that fires it.
Properties · 3
$linksarrayprotected- Links related to the response.
$matched_routestringprotected- The route that was to create the response.
$matched_handlernull|arrayprotected- The handler that was used to create the response.
Methods · 12
- add_link()Adds a link to the response.
- remove_link()Removes a link from the response.
- add_links()Adds multiple links to the response.
- get_links()Retrieves links for the response.
- link_header()Sets a single link header.
- get_matched_route()Retrieves the route that was used.
- set_matched_route()Sets the route (regex for path) that caused the response.
- get_matched_handler()Retrieves the handler that was used to generate the response.
- set_matched_handler()Sets the handler that was responsible for generating the response.
- is_error()Checks if the response is an error, i.e. >= 400 response code.
- as_error()Retrieves a WP_Error object from the response.
- get_curies()Retrieves the CURIEs (compact URIs) used for relations.
Changelog
Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/rest-api/class-wp-rest-response.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.