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.

git-svn-id: https://develop.svn.wordpress.org/trunk@41187 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2017-07-30 14:40:42 +00:00
parent b22e409f81
commit ddc6fafd06
2 changed files with 31 additions and 4 deletions
+5 -3
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 );