Title: WP_REST_Response::link_header
Published: December 9, 2015
Last modified: May 20, 2026

---

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

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#wp--skip-link--target)

Sets a single link header.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#description)󠁿

{@internal The $rel parameter is first, as this looks nicer when sending multiple.}

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#parameters)󠁿

 `$rel`stringrequired

Link relation. Either an IANA registered type, or an absolute URL.

`$link`stringrequired

Target IRI for the link.

`$other`arrayoptional

Other parameters to send, as an associative array.

Default:`array()`

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/class-wp-rest-response.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/class-wp-rest-response.php#L150)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/class-wp-rest-response.php#L150-L161)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_response/link_header/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_response%2Flink_header%2F)
before being able to contribute a note or feedback.