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 0a2cf5d49b..326cafcc7e 100644
|
a
|
b
|
class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller { |
| 220 | 220 | $prepared_post->ID = $post->ID; |
| 221 | 221 | $user_id = get_current_user_id(); |
| 222 | 222 | |
| 223 | | if ( ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status ) && $post->post_author == $user_id ) { |
| 224 | | // Draft posts for the same author: autosaving updates the post and does not create a revision. |
| | 223 | /** |
| | 224 | * Auto save updates the original post when the |
| | 225 | * 1. post status is draft or auto-draft |
| | 226 | * 2. post author is the current logged in user |
| | 227 | * 3. current user holds the post lock |
| | 228 | */ |
| | 229 | if ( ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status ) && $post->post_author == $user_id && false === wp_check_post_lock( $post->ID ) ) { |
| 225 | 230 | // Convert the post object to an array and add slashes, wp_update_post() expects escaped array. |
| 226 | 231 | $autosave_id = wp_update_post( wp_slash( (array) $prepared_post ), true ); |
| 227 | 232 | } else { |