From 04f62997d3860e2302cb718084825dc7abe3a5e2 Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Thu, 11 Nov 2021 19:07:52 +0000 Subject: [PATCH] Posts, Post Types: Update `_edit_last` meta when posts are edited in bulk. When posts are edited in bulk, the `_edit_last` meta was not updated for each post. This change adds a call to update the `_edit_last` meta to the current user ID for each post the is updated. Props calebwoodbridge, peterwilsoncc, guillaumeturpin, audrasjb. Fixes #42446. git-svn-id: https://develop.svn.wordpress.org/trunk@52141 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/post.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index 718e18d1d5..b2cff75e08 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -640,7 +640,9 @@ function bulk_edit_posts( $post_data = null ) { // Prevent wp_insert_post() from overwriting post format with the old data. unset( $post_data['tax_input']['post_format'] ); - $updated[] = wp_update_post( $post_data ); + $post_id = wp_update_post( $post_data ); + update_post_meta( $post_id, '_edit_last', get_current_user_id() ); + $updated[] = $post_id; if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) { if ( 'sticky' === $post_data['sticky'] ) {