WordPress at a glance
function is not described

WP_REST_Posts_Controller::get_item() public WP 4.7.0

Retrieves a single post.

{} It's a method of the class: WP_REST_Posts_Controller{}

No Hooks.

Return

WP_REST_Response/WP_Error. Response object on success, or WP_Error object on failure.

Usage

$WP_REST_Posts_Controller = new WP_REST_Posts_Controller();
$WP_REST_Posts_Controller->get_item( $request );
$request(WP_REST_Request) (required)
Full details about the request.

Changelog

Since 4.7.0 Introduced.

Code of WP_REST_Posts_Controller::get_item() WP 5.5.1

<?php
public function get_item( $request ) {
	$post = $this->get_post( $request['id'] );
	if ( is_wp_error( $post ) ) {
		return $post;
	}

	$data     = $this->prepare_item_for_response( $post, $request );
	$response = rest_ensure_response( $data );

	if ( is_post_type_viewable( get_post_type_object( $post->post_type ) ) ) {
		$response->link_header( 'alternate', get_permalink( $post->ID ), array( 'type' => 'text/html' ) );
	}

	return $response;
}