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.
Built from https://develop.svn.wordpress.org/trunk@52141


git-svn-id: http://core.svn.wordpress.org/trunk@51733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
davidbaumwald 2021-11-11 19:09:00 +00:00
parent 841e45a864
commit 00403bc675
2 changed files with 4 additions and 2 deletions

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. // Prevent wp_insert_post() from overwriting post format with the old data.
unset( $post_data['tax_input']['post_format'] ); 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 ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) {
if ( 'sticky' === $post_data['sticky'] ) { if ( 'sticky' === $post_data['sticky'] ) {

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-alpha-52140'; $wp_version = '5.9-alpha-52141';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.