WordPress at a glance
function is not described

WP_REST_Autosaves_Controller::get_items() public WP 5.0.0

Gets a collection of autosaves using wp_get_post_autosave.

Contains the user's autosave, for empty if it doesn't exist.

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

No Hooks.

Return

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

Usage

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

Changelog

Since 5.0.0 Introduced.

Code of WP_REST_Autosaves_Controller::get_items() WP 5.5.1

<?php
public function get_items( $request ) {
	$parent = $this->get_parent( $request['id'] );
	if ( is_wp_error( $parent ) ) {
		return $parent;
	}

	$response  = array();
	$parent_id = $parent->ID;
	$revisions = wp_get_post_revisions( $parent_id, array( 'check_enabled' => false ) );

	foreach ( $revisions as $revision ) {
		if ( false !== strpos( $revision->post_name, "{$parent_id}-autosave" ) ) {
			$data       = $this->prepare_item_for_response( $revision, $request );
			$response[] = $this->prepare_response_for_collection( $data );
		}
	}

	return rest_ensure_response( $response );
}