On this page
WP_REST_Taxonomies_Controller::prepare_links( WP_Taxonomy $taxonomy ): array
Prepares links for the request.
Parameters
$taxonomyWP_Taxonomy Required-
The taxonomy.
Return
array Links for the given taxonomy.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php. View all references
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 ) ),
),
);
}
Related
Uses
| Uses | Description |
|---|---|
| rest_get_route_for_taxonomy_items() wp-includes/rest-api.php | Gets the REST API route for a taxonomy. |
| rest_url() wp-includes/rest-api.php | Retrieves the URL to a REST endpoint. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Taxonomies_Controller::prepare_item_for_response() wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Prepares a taxonomy object for serialization. |
Changelog
| Version | Description |
|---|---|
| 6.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_taxonomies_controller/prepare_links