Ticket #41396: 41396.2.diff
| File 41396.2.diff, 2.0 KB (added by , 9 years ago) |
|---|
-
src/wp-admin/includes/post.php
564 564 continue; 565 565 } 566 566 567 if ( isset( $post_data['post_format'] ) ) { 568 set_post_format( $post_ID, $post_data['post_format'] ); 569 unset( $post_data['tax_input']['post_format'] ); 570 } 571 567 572 $updated[] = wp_update_post( $post_data ); 568 573 569 574 if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) { … … 572 577 else 573 578 unstick_post( $post_ID ); 574 579 } 575 576 if ( isset( $post_data['post_format'] ) )577 set_post_format( $post_ID, $post_data['post_format'] );578 580 } 579 581 580 582 return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked ); -
tests/phpunit/tests/admin/includesPost.php
207 207 /** 208 208 * @ticket 27792 209 209 */ 210 function test_bulk_edit_posts_stomping() {210 public function test_bulk_edit_posts_stomping() { 211 211 wp_set_current_user( self::$admin_id ); 212 212 213 213 $post1 = self::factory()->post->create( array( … … 245 245 } 246 246 247 247 /** 248 * @ticket 41396 249 */ 250 public function test_bulk_edit_posts_should_set_post_format_before_wp_update_post_runs() { 251 wp_set_current_user( self::$admin_id ); 252 253 $request = array( 254 'post_format' => 'aside', 255 '_status' => -1, 256 'post' => array( self::$post_id ), 257 ); 258 259 add_action( 'save_post', array( $this, 'check_post_format' ) ); 260 261 bulk_edit_posts( $request ); 262 263 remove_action( 'save_post', array( $this, 'check_post_format' ) ); 264 } 265 266 public function check_post_format( $post_id ) { 267 if ( self::$post_id === $post_id ) { 268 $this->assertEquals( 'aside', get_post_format( $post_id ) ); 269 } 270 } 271 272 /** 248 273 * @ticket 38293 249 274 */ 250 275 public function test_user_cant_delete_protected_meta() {