WP_REST_Response::link_header( string $rel, string $link, array $other = array() )
Sets a single link header.
Description Description
Parameters Parameters
- $rel
-
(string) (Required) Link relation. Either an IANA registered type, or an absolute URL.
- $link
-
(string) (Required) Target IRI for the link.
- $other
-
(array) (Optional) Other parameters to send, as an assocative array.
Default value: array()
Source Source
File: wp-includes/rest-api/class-wp-rest-response.php
public function link_header( $rel, $link, $other = array() ) { $header = '<' . $link . '>; rel="' . $rel . '"'; foreach ( $other as $key => $value ) { if ( 'title' === $key ) { $value = '"' . $value . '"'; } $header .= '; ' . $key . '=' . $value; } $this->header( 'Link', $header, false ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |