W3cubDocs

/WordPress

WP_REST_Template_Autosaves_Controller::prepare_links( WP_Block_Template $template ): array

Prepares links for the request.

Parameters

$templateWP_Block_Templaterequired
Template.

Return

array Links for the given post.

Source

protected function prepare_links( $template ) {
	$links = array(
		'self'   => array(
			'href' => rest_url( sprintf( '/%s/%s/%s/%s/%d', $this->namespace, $this->parent_base, $template->id, $this->rest_base, $template->wp_id ) ),
		),
		'parent' => array(
			'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $this->parent_base, $template->id ) ),
		),
	);

	return $links;
}

Changelog

Version Description
6.4.0 Introduced.

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