From 3d26fab9f604a3766606128c239464f70df5c93b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 30 Jul 2017 14:41:42 +0000 Subject: [PATCH] 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 --- wp-admin/includes/post.php | 8 +++++--- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index bc3ee7849d..febe05afaf 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 4e5aa1f328..e47b6c1edb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.