[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
REST API: WP_REST_Response class
File Size: | 293 lines (7 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_REST_Response:: (12 methods):
add_link()
remove_link()
add_links()
get_links()
link_header()
get_matched_route()
set_matched_route()
get_matched_handler()
set_matched_handler()
is_error()
as_error()
get_curies()
Class: WP_REST_Response - X-Ref
Core class used to implement a REST response object.add_link( $rel, $href, $attributes = array() X-Ref |
Adds a link to the response. param: string $rel Link relation. Either an IANA registered type, param: string $href Target URI for the link. param: array $attributes Optional. Link parameters to send along with the URL. Default empty array. since: 4.4.0 |
remove_link( $rel, $href = null ) X-Ref |
Removes a link from the response. param: string $rel Link relation. Either an IANA registered type, or an absolute URL. param: string $href Optional. Only remove links for the relation matching the given href. since: 4.4.0 |
add_links( $links ) X-Ref |
Adds multiple links to the response. Link data should be an associative array with link relation as the key. The value can either be an associative array of link attributes (including `href` with the URL for the response), or a list of these associative arrays. param: array $links Map of link relation to list of links. since: 4.4.0 |
get_links() X-Ref |
Retrieves links for the response. return: array List of links. since: 4.4.0 |
link_header( $rel, $link, $other = array() X-Ref |
Sets a single link header. param: string $rel Link relation. Either an IANA registered type, or an absolute URL. param: string $link Target IRI for the link. param: array $other Optional. Other parameters to send, as an associative array. since: 4.4.0 |
get_matched_route() X-Ref |
Retrieves the route that was used. return: string The matched route. since: 4.4.0 |
set_matched_route( $route ) X-Ref |
Sets the route (regex for path) that caused the response. param: string $route Route name. since: 4.4.0 |
get_matched_handler() X-Ref |
Retrieves the handler that was used to generate the response. return: null|array The handler that was used to create the response. since: 4.4.0 |
set_matched_handler( $handler ) X-Ref |
Sets the handler that was responsible for generating the response. param: array $handler The matched handler. since: 4.4.0 |
is_error() X-Ref |
Checks if the response is an error, i.e. >= 400 response code. return: bool Whether the response is an error. since: 4.4.0 |
as_error() X-Ref |
Retrieves a WP_Error object from the response. return: WP_Error|null WP_Error or null on not an errored response. since: 4.4.0 |
get_curies() X-Ref |
Retrieves the CURIEs (compact URIs) used for relations. return: array Compact URIs. since: 4.5.0 |
Generated: Thu Nov 21 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |