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

In this article

Sets a single link header.

Parameters

$relstringrequired
Link relation. Either an IANA registered type, or an absolute URL.
$linkstringrequired
Target IRI for the link.
$otherarrayoptional
Other parameters to send, as an associative array.

Default:array()

Source

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

VersionDescription
4.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.