WordPress at Your Fingertips
function is not described

WP_REST_Search_Handler::prepare_item() public WP 5.0.0

Prepares the search result for a given ID.

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

No Hooks.

Return

Array. Associative array containing all fields for the item.

Usage

$WP_REST_Search_Handler = new WP_REST_Search_Handler();
$WP_REST_Search_Handler->prepare_item( $id, $fields );
$id(int|string) (required)
Item ID.
$fields(array) (required)
Fields to include for the item.

Changelog

Since 5.0.0 Introduced.
Since 5.6.0 The $id parameter can accept a string.

Code of WP_REST_Search_Handler::prepare_item() WP 5.8

<?php
abstract public function prepare_item( $id, array $fields );