WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_REST_Response::add_links() public WP 4.4.0

Adds multiple links to the response.

Link data should be an associative array with link relation as the key. The value can either be an associative array of link attributes (including href with the URL for the response), or a list of these associative arrays.

{} Это метод класса: WP_REST_Response{}

Хуков нет.


null. Ничего.


$WP_REST_Response = new WP_REST_Response();
$WP_REST_Response->add_links( $links );
$links(массив) (обязательный)
Map of link relation to list of links.

Список изменений

С версии 4.4.0 Введена.

Код WP_REST_Response::add_links() WP 5.8.1

public function add_links( $links ) {
	foreach ( $links as $rel => $set ) {
		// If it's a single link, wrap with an array for consistent handling.
		if ( isset( $set['href'] ) ) {
			$set = array( $set );

		foreach ( $set as $attributes ) {
			$this->add_link( $rel, $attributes['href'], $attributes );