--- a/wp/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php Fri Sep 05 18:52:52 2025 +0200
@@ -305,6 +305,10 @@
return $parent;
}
+ if ( $request->is_method( 'HEAD' ) ) {
+ // Return early as this handler doesn't add any response headers.
+ return new WP_REST_Response( array() );
+ }
$response = array();
$parent_id = $parent->ID;
$revisions = wp_get_post_revisions( $parent_id, array( 'check_enabled' => false ) );
@@ -448,6 +452,11 @@
// Restores the more descriptive, specific name for use within this method.
$post = $item;
+ // Don't prepare the response body for HEAD requests.
+ if ( $request->is_method( 'HEAD' ) ) {
+ /** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php */
+ return apply_filters( 'rest_prepare_autosave', new WP_REST_Response( array() ), $post, $request );
+ }
$response = $this->revisions_controller->prepare_item_for_response( $post, $request );
$fields = $this->get_fields_for_response( $request );