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

Sets a single link header.


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()


Top ↑

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

Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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