Quick/Bulk Edit: Ensure scheduled posts are published when using Bulk Edit.

This changeset ensures scheduled posts are actually published when changing their status to "Published" using bulk edit. Also adds related unit tests.

Props siobhan, Clorith, webcommsat, cadic, oglekler, audrasjb, pavanpatil1.
Fixes #31635.



Built from https://develop.svn.wordpress.org/trunk@56123


git-svn-id: http://core.svn.wordpress.org/trunk@55635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-07-02 08:04:21 +00:00
parent 5933075eae
commit 9e1170351e
2 changed files with 10 additions and 1 deletions

View File

@ -668,6 +668,15 @@ 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'] );
// Reset post date of scheduled post to be published.
if (
in_array( $post->post_status, array( 'future', 'draft' ), true ) &&
'publish' === $post_data['post_status']
) {
$post_data['post_date'] = current_time( 'mysql' );
$post_data['post_date_gmt'] = '';
}
$post_id = wp_update_post( $post_data );
update_post_meta( $post_id, '_edit_last', get_current_user_id() );
$updated[] = $post_id;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-beta2-56122';
$wp_version = '6.3-beta2-56123';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.