WP_REST_Search_Handler::prepare_item( int|string $id, array $fields ): array

In this article

Prepares the search result for a given ID.

Parameters

$idint|stringrequired
Item ID.
$fieldsarrayrequired
Fields to include for the item.

Return

array Associative array containing all fields for the item.

Source

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

Changelog

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

User Contributed Notes

You must log in before being able to contribute a note or feedback.