diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
index 6b2da40eb3..154f582eb1 100644
a
|
b
|
class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller { |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | | if ( ! $autosave_is_different ) { |
375 | | return new WP_Error( |
376 | | 'rest_autosave_no_changes', |
377 | | __( 'There is nothing to save. The autosave and the post content are the same.' ), |
378 | | array( 'status' => 400 ) |
379 | | ); |
380 | | } |
381 | | |
382 | 374 | $user_id = get_current_user_id(); |
383 | 375 | |
384 | 376 | // Store one autosave per author. If there is already an autosave, overwrite it. |
385 | 377 | $old_autosave = wp_get_post_autosave( $post_id, $user_id ); |
386 | 378 | |
| 379 | if ( ! $autosave_is_different && $old_autosave ) { |
| 380 | // Nothing to save, return the existing autosave. |
| 381 | return $old_autosave->ID; |
| 382 | } |
| 383 | |
387 | 384 | if ( $old_autosave ) { |
388 | 385 | $new_autosave['ID'] = $old_autosave->ID; |
389 | 386 | $new_autosave['post_author'] = $user_id; |