WP_REST_Taxonomies_Controller::prepare_links
Prepares links for the request.
Method of the class: WP_REST_Taxonomies_Controller{}
No Hooks.
Returns
Array. Links for the given taxonomy.
Usage
// protected - for code of main (parent) or child class $result = $this->prepare_links( $taxonomy );
- $taxonomy(WP_Taxonomy) (required)
- The taxonomy.
Changelog
| Since 6.1.0 | Introduced. |
WP_REST_Taxonomies_Controller::prepare_links() WP REST Taxonomies Controller::prepare links code WP 7.0
protected function prepare_links( $taxonomy ) {
return array(
'collection' => array(
'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
),
'https://api.w.org/items' => array(
'href' => rest_url( rest_get_route_for_taxonomy_items( $taxonomy->name ) ),
),
);
}