WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 13 months ago

#19907 new defect (bug)

Updating an unpublished draft post in quick-edit mode sets the post's publish date

Reported by: uxtremist Owned by:
Milestone: Future Release Priority: normal
Severity: major Version: 2.7
Component: Quick/Bulk Edit Keywords: has-patch needs-unit-tests editorial-flow
Focuses: Cc:

Description

Problem:

  • If you update an unpublished draft post in quick-edit mode, the post's publish date is saved.
  • Then, later on, when you actually publish the post, its publish date is incorrect.

Suggested fix:

  • If the post is a draft, do not automatically set the post's publish date in quick-edit mode.

Steps to reproduce:

(1) Go to WP-Admin -> Posts.

(2) Create and save a new post. Make sure you click "Save Draft" — not "Publish".

(3) Note that the post is marked as "Publish immediately"; that is, it has no publish date.

(4) Go back to WP-Admin -> Posts.

(5) Hover your pointer over the post you just created. Click "Quick Edit".

— Note that in the panel that appears, the "Date" field is automatically set to [the current date and time].

(6) Click "Update" in quick-edit mode.

(7) Hover your pointer over the post you just updated. Click "Edit".

— Note that in the Edit Post page that appears, the post is now marked as "Publish on: [the date and time from step (5)]"

Attachments (3)

19907.patch (627 bytes) - added by SergeyBiryukov 4 years ago.
19907.2.patch (626 bytes) - added by SergeyBiryukov 4 years ago.
27578.diff (519 bytes) - added by Denis-de-Bernardy 17 months ago.
Alternative fix, which also fixes the issue when a draft post is trashed or untrashed

Download all attachments as: .zip

Change History (23)

comment:1 @nacin4 years ago

  • Milestone changed from Awaiting Review to 3.4
  • Severity changed from normal to major

@SergeyBiryukov4 years ago

@SergeyBiryukov4 years ago

comment:2 @SergeyBiryukov4 years ago

  • Keywords has-patch added; needs-patch removed
  • Version changed from 3.3.1 to 2.7

Has been this way since Quick Edit was introduced in 2.7 (#8144).

The problem is that edit_date is true by default:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/js/inline-edit-post.dev.js#L238
And the condition for $clear_date in wp_update_post() is not satisfied:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/post.php#L2693

19907.patch brings the similar check and comment into edit_post().

19907.2.patch sets edit_date to false (doesn't touch post_date_gmt).

Last edited 4 years ago by SergeyBiryukov (previous) (diff)

comment:3 @jane3 years ago

  • Keywords ux-feedback removed

I don't know that I'd call it major, since it's been there since 2.7, but the desired behavior is that when using quick edit when a post is a draft, it should adjust 'last edited' not 'publish' time.

comment:4 @nacin3 years ago

Closely related, #16985.

comment:5 @nacin3 years ago

  • Keywords needs-unit-tests added

comment:6 @nacin3 years ago

  • Keywords punt added

Needs unit tests. Thinking punt.

comment:7 @ryan3 years ago

  • Milestone changed from 3.4 to Future Release

comment:9 @SergeyBiryukov3 years ago

  • Keywords punt removed

comment:10 @navjotjsingh3 years ago

  • Cc navjotjsingh@… added

comment:11 @SergeyBiryukov3 years ago

  • Keywords editorial-flow added

comment:12 @mintindeed2 years ago

  • Cc gabriel.koen@… added

comment:13 @SergeyBiryukov17 months ago

#27578 was marked as a duplicate.

@Denis-de-Bernardy17 months ago

Alternative fix, which also fixes the issue when a draft post is trashed or untrashed

comment:14 @Denis-de-Bernardy17 months ago

#22350 was marked as a duplicate.

comment:15 @Denis-de-Bernardy17 months ago

I've closed #22350 as dup, since the patch I just uploaded fixes both.

comment:16 @georgestephanis16 months ago

Patch will need to be rewritten to apply cleanly with the current core php brace syntax mandate. Anyone want easy props to rewrite?

comment:17 @SergeyBiryukov16 months ago

  • Milestone changed from Future Release to 4.0

comment:18 @SergeyBiryukov15 months ago

#28522 was marked as a duplicate.

comment:19 @ircbot13 months ago

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.

comment:20 @DrewAPicture13 months ago

  • Milestone changed from 4.0 to Future Release

Patch applies with fuzz. Still needs unit tests. Punting.

Note: See TracTickets for help on using tickets.