Uses
Uses | Description |
---|---|
wp-includes/functions.php: wp_list_filter() | Filters a list of objects, based on a set of key => value arguments. |
Removes a link from the response.
(string) (Required) Link relation. Either an IANA registered type, or an absolute URL.
(string) (Optional) Only remove links for the relation matching the given href.
Default value: null
File: wp-includes/rest-api/class-wp-rest-response.php
public function remove_link( $rel, $href = null ) { if ( ! isset( $this->links[ $rel ] ) ) { return; } if ( $href ) { $this->links[ $rel ] = wp_list_filter( $this->links[ $rel ], array( 'href' => $href ), 'NOT' ); } else { $this->links[ $rel ] = array(); } if ( ! $this->links[ $rel ] ) { unset( $this->links[ $rel ] ); } }
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/remove_link