mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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:
@@ -207,7 +207,7 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 27792
|
||||
*/
|
||||
function test_bulk_edit_posts_stomping() {
|
||||
public function test_bulk_edit_posts_stomping() {
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$post1 = self::factory()->post->create( array(
|
||||
@@ -244,6 +244,31 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
||||
$this->assertEquals( 'closed', $post->ping_status );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 41396
|
||||
*/
|
||||
public function test_bulk_edit_posts_should_set_post_format_before_wp_update_post_runs() {
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$request = array(
|
||||
'post_format' => 'aside',
|
||||
'_status' => -1,
|
||||
'post' => array( self::$post_id ),
|
||||
);
|
||||
|
||||
add_action( 'save_post', array( $this, 'check_post_format' ) );
|
||||
|
||||
bulk_edit_posts( $request );
|
||||
|
||||
remove_action( 'save_post', array( $this, 'check_post_format' ) );
|
||||
}
|
||||
|
||||
public function check_post_format( $post_id ) {
|
||||
if ( self::$post_id === $post_id ) {
|
||||
$this->assertEquals( 'aside', get_post_format( $post_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 38293
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user