WP_REST_Templates_Controller::prepare_links( integer $id )

Prepares links for the request.

Parameters

$id

(integer) (Required) ID.

Return

(array) Links for the given post.

Source

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

protected function prepare_links( $id ) {
		$base = sprintf( '%s/%s', $this->namespace, $this->rest_base );

		$links = array(
			'self'       => array(
				'href' => rest_url( trailingslashit( $base ) . $id ),
			),
			'collection' => array(
				'href' => rest_url( $base ),
			),
			'about'      => array(
				'href' => rest_url( 'wp/v2/types/' . $this->post_type ),
			),
		);

		return $links;
	}

Changelog

Version Description
5.8.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/prepare_links