Post Formats: In `bulk_edit_posts()`, set post format before the post is updated, for consistency with `edit_post()`.

This makes sure that plugins hooked to `save_post` get the right post format.

Props Chouby, SergeyBiryukov.
Fixes #41396.
Built from https://develop.svn.wordpress.org/trunk@41187


git-svn-id: http://core.svn.wordpress.org/trunk@41027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2017-07-30 14:41:42 +00:00
parent 7f5e00ba29
commit 3d26fab9f6
2 changed files with 6 additions and 4 deletions

View File

@ -564,6 +564,11 @@ function bulk_edit_posts( $post_data = null ) {
continue;
}
if ( isset( $post_data['post_format'] ) ) {
set_post_format( $post_ID, $post_data['post_format'] );
unset( $post_data['tax_input']['post_format'] );
}
$updated[] = wp_update_post( $post_data );
if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) {
@ -572,9 +577,6 @@ function bulk_edit_posts( $post_data = null ) {
else
unstick_post( $post_ID );
}
if ( isset( $post_data['post_format'] ) )
set_post_format( $post_ID, $post_data['post_format'] );
}
return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41186';
$wp_version = '4.9-alpha-41187';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.