Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#41396 closed defect (bug) (fixed)

set_post_format: inconsistency between edit_post and bulk_edit_posts

Reported by: chouby's profile Chouby Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version: 3.3
Component: Post Formats Keywords: has-patch commit
Focuses: Cc:

Description

In edit_post(), set_post_format() is called before the post is saved. In bulk_edit_posts(), it is called after.

This can cause trouble to the plugins expecting to have the right post format, when hooking to the action save_post.

Attachments (2)

41396.diff (809 bytes) - added by Chouby 7 years ago.
41396.2.diff (2.0 KB) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (8)

@Chouby
7 years ago

#1 @Chouby
7 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
7 years ago

  • Milestone changed from Awaiting Review to 4.9
  • Version changed from 3.7 to 3.3

Introduced in [18722].

#3 @SergeyBiryukov
7 years ago

  • Keywords commit added

Simply moving set_post_format() call above wp_update_post() is not enough, as wp_insert_post() then overwrites the format with the old data from $post_data['tax_input']['post_format'].

41396.2.diff adds unset( $post_data['tax_input']['post_format'] ) and a unit test.

#4 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 41187:

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.

#5 @SergeyBiryukov
7 years ago

#34764 was marked as a duplicate.

#6 @SergeyBiryukov
6 years ago

In 44670:

Post Formats: Prevent Bulk Edit from unintentionally changing post format to Standard even if set to "No change".

Correct the logic in [41187].

Props birgire, mukesh27, lanche86.
Fixes #44914. See #41396.

Note: See TracTickets for help on using tickets.