public function prepare_response_for_collection( $response ) { if ( !
( $response instanceof WP_REST_Response
) ) { return $response;
} $data =
(array) $response->
get_data();
$server =
rest_get_server();
$links =
$server::
get_compact_response_links( $response );
if ( !
empty( $links ) ) { $data['_links'
] =
$links;
} return $data;
} /**
* Filters a response based on the context defined in the schema.
*
* @since 4.7.0
*
* @param array $response_data Response data to filter.
* @param string $context Context defined in the schema.
* @return array Filtered response.
*/