WP_REST_Post_Types_Controller::prepare_links( WP_Post_Type $post_type )

Prepares links for the request.


Parameters

$post_type

(Required) The post type.


Return

(array) Links for the given post type.


Source

File: wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php

	protected function prepare_links( $post_type ) {
		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_post_type_items( $post_type->name ) ),
			),
		);
	}


Changelog

Changelog
Version Description
6.1.0 Introduced.