WP_REST_Taxonomies_Controller::prepare_links()protectedWP 6.1.0

Prepares links for the request.

Method of the class: WP_REST_Taxonomies_Controller{}

No Hooks.

Return

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() code WP 6.1.1

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 ) ),
		),
	);
}