- Timestamp:
- 09/11/2022 10:33:29 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
r51962 r54130 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 ) { 223 // We need to check post lock to ensure the original author didn't leave their browser tab open. 224 if ( ! function_exists( 'wp_check_post_lock' ) ) { 225 require_once ABSPATH . 'wp-admin/includes/post.php'; 226 } 227 228 $post_lock = wp_check_post_lock( $post->ID ); 229 $is_draft = 'draft' === $post->post_status || 'auto-draft' === $post->post_status; 230 231 if ( $is_draft && (int) $post->post_author === $user_id && ! $post_lock ) { 224 232 // Draft posts for the same author: autosaving updates the post and does not create a revision. 225 233 // Convert the post object to an array and add slashes, wp_update_post() expects escaped array.
Note: See TracChangeset
for help on using the changeset viewer.