WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 3 weeks 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 2 years ago.
19907.2.patch (626 bytes) - added by SergeyBiryukov 2 years ago.
27578.diff (519 bytes) - added by Denis-de-Bernardy 3 weeks ago.
Alternative fix, which also fixes the issue when a draft post is trashed or untrashed

Download all attachments as: .zip

Change History (18)

comment:1 nacin2 years ago

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

SergeyBiryukov2 years ago

SergeyBiryukov2 years ago

comment:2 SergeyBiryukov2 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 instead of post_date_gmt.

Version 0, edited 2 years ago by SergeyBiryukov (next)

comment:3 jane2 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 nacin2 years ago

Closely related, #16985.

comment:5 nacin2 years ago

  • Keywords needs-unit-tests added

comment:6 nacin2 years ago

  • Keywords punt added

Needs unit tests. Thinking punt.

comment:7 ryan2 years ago

  • Milestone changed from 3.4 to Future Release

comment:9 SergeyBiryukov18 months ago

  • Keywords punt removed

comment:10 navjotjsingh17 months ago

  • Cc navjotjsingh@… added

comment:11 SergeyBiryukov15 months ago

  • Keywords editorial-flow added

comment:12 mintindeed10 months ago

  • Cc gabriel.koen@… added

comment:13 SergeyBiryukov3 weeks ago

#27578 was marked as a duplicate.

Denis-de-Bernardy3 weeks ago

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

comment:14 Denis-de-Bernardy3 weeks ago

#22350 was marked as a duplicate.

comment:15 Denis-de-Bernardy3 weeks ago

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

Note: See TracTickets for help on using tickets.