WordPress at a glance
function is not described

WP_REST_Post_Search_Handler::prepare_item_links() WP 5.0.0

Prepares links for the search result of a given ID.

This is a method of the class: WP_REST_Post_Search_Handler

No Hooks.

Return

Array. Links for the given item.

Usage

$WP_REST_Post_Search_Handler = new WP_REST_Post_Search_Handler();
$var = $WP_REST_Post_Search_Handler->prepare_item_links( $id );
$id(int) (required)
Item ID.

Changelog

Since 5.0.0 Introduced.

Code of WP REST Post Search Handler::prepare item links: wp-includes/rest-api/search/class-wp-rest-post-search-handler.php WP 5.2.2

<?php
public function prepare_item_links( $id ) {
	$post = get_post( $id );

	$links = array();

	$item_route = $this->detect_rest_item_route( $post );
	if ( ! empty( $item_route ) ) {
		$links['self'] = array(
			'href'       => rest_url( $item_route ),
			'embeddable' => true,
		);
	}

	$links['about'] = array(
		'href' => rest_url( 'wp/v2/types/' . $post->post_type ),
	);

	return $links;
}