$new_autosave['ID'
] =
$old_autosave->ID;
$new_autosave['post_author'
] =
$user_id;
/** This filter is documented in wp-admin/post.php */
do_action( 'wp_creating_autosave',
$new_autosave );
// wp_update_post() expects escaped array.
return wp_update_post( wp_slash( $new_autosave ) );
} // Create the new autosave as a special post revision.
return _wp_put_post_revision( $post_data, true
);
} /**
* Prepares the revision for the REST response.
*
* @since 5.0.0
* @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
*
* @param WP_Post $item Post revision object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/