WP_REST_Term_Search_Handler::prepare_item_links( int $id )
Prepares links for the search result of a given ID.
Parameters
- $id
-
(int) (Required) Item ID.
Return
(array) Links for the given item.
Source
File: wp-includes/rest-api/search/class-wp-rest-term-search-handler.php
public function prepare_item_links( $id ) { $term = get_term( $id ); $links = array(); $item_route = rest_get_route_for_term( $term ); if ( $item_route ) { $links['self'] = array( 'href' => rest_url( $item_route ), 'embeddable' => true, ); } $links['about'] = array( 'href' => rest_url( sprintf( 'wp/v2/taxonomies/%s', $term->taxonomy ) ), ); return $links; }
Changelog
Version | Description |
---|---|
5.6.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_term_search_handler/prepare_item_links