WordPress at a glance
function is not described

WP_REST_Revisions_Controller::delete_item() public WP 4.7.0

Deletes a single revision.

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

Hooks from the method
Return

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

Usage

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

Changelog

Since 4.7.0 Introduced.

Code of WP_REST_Revisions_Controller::delete_item() WP 5.5.3

<?php
public function delete_item( $request ) {
	$revision = $this->get_revision( $request['id'] );
	if ( is_wp_error( $revision ) ) {
		return $revision;
	}

	$force = isset( $request['force'] ) ? (bool) $request['force'] : false;

	// We don't support trashing for revisions.
	if ( ! $force ) {
		return new WP_Error(
			'rest_trash_not_supported',
			/* translators: %s: force=true */
			sprintf( __( "Revisions do not support trashing. Set '%s' to delete." ), 'force=true' ),
			array( 'status' => 501 )
		);
	}

	$previous = $this->prepare_item_for_response( $revision, $request );

	$result = wp_delete_post( $request['id'], true );

	/**
	 * Fires after a revision is deleted via the REST API.
	 *
	 * @since 4.7.0
	 *
	 * @param WP_Post|false|null $result The revision object (if it was deleted or moved to the Trash successfully)
	 *                                   or false or null (failure). If the revision was moved to the Trash, $result represents
	 *                                   its new state; if it was deleted, $result represents its state before deletion.
	 * @param WP_REST_Request $request The request sent to the API.
	 */
	do_action( 'rest_delete_revision', $result, $request );

	if ( ! $result ) {
		return new WP_Error(
			'rest_cannot_delete',
			__( 'The post cannot be deleted.' ),
			array( 'status' => 500 )
		);
	}

	$response = new WP_REST_Response();
	$response->set_data(
		array(
			'deleted'  => true,
			'previous' => $previous->get_data(),
		)
	);
	return $response;
}