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
This commit is contained in:
David Baumwald 2021-11-11 19:07:52 +00:00
parent d762d720cc
commit 04f62997d3

View File

@ -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'] ) {