Used By
Used By | Description |
---|---|
wp-includes/rest-api/class-wp-rest-response.php: WP_REST_Response::add_links() | Adds multiple links to the response. |
Adds a link to the response.
(string) (Required) Link relation. Either an IANA registered type, or an absolute URL.
(string) (Required) Target URI for the link.
(array) (Optional) Link parameters to send along with the URL.
Default value: array()
File: wp-includes/rest-api/class-wp-rest-response.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, ); }
Version | Description |
---|---|
4.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_response/add_link