W3cubDocs

/WordPress

WP_REST_Response::link_header( string $rel, string $link, array $other = array() )

Sets a single link header.

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

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 );
	}

Changelog

Version Description
4.4.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_response/link_header