WordPress at a glance
функция не описана

WP_REST_Response::add_link() public WP 4.4.0

Adds a link to the response.

It's a method of the class: WP_REST_Response{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$WP_REST_Response = new WP_REST_Response();
$WP_REST_Response->add_link( $rel, $href, $attributes );
$rel(string) (required)
Link relation. Either an IANA registered type, or an absolute URL.
$href(string) (required)
Target URI for the link.
$attributes(array)
Link parameters to send along with the URL.
Default: empty array

Changelog

Since 4.4.0 Introduced.

Код WP_REST_Response::add_link() WP 5.5.1

<?php
public function add_link( $rel, $href, $attributes = array() ) {
	if ( empty( $this->links[ $rel ] ) ) {
		$this->links[ $rel ] = array();
	}

	if ( isset( $attributes['href'] ) ) {
		// Remove the href attribute, as it's used for the main URL.
		unset( $attributes['href'] );
	}

	$this->links[ $rel ][] = array(
		'href'       => $href,
		'attributes' => $attributes,
	);
}