Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#41336 closed defect (bug) (fixed)

Changeset saved with `publish` status and future date is not scheduled

Reported by: dlh's profile dlh Owned by: westonruter's profile westonruter
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch
Focuses: Cc:


The behavior of WP_Customize_Manager::save_changeset_post() differs from wp_insert_post() in how it handles a post date in the future with a post status of publish.

wp_insert_post() will keep the date and change the post status to future:

whereas save_changeset_post() resets the date and publishes the changeset immediately:

I found this difference unexpected, although I apologize if I've overlooked discussions about it.

The attached patches propose different updates to save_changeset_post() that would try to reduce the discrepancy. One patch would switch the changeset status from publish to future when the changeset date is in the future, in the style of wp_insert_post(). The other would return a WP_Error to at least prevent the changeset from being published immediately.

Attachments (2)

41336.diff (1.4 KB) - added by dlh 7 years ago.
41336.2.diff (1.4 KB) - added by dlh 7 years ago.

Download all attachments as: .zip

Change History (4)

7 years ago

7 years ago

#1 @westonruter
7 years ago

  • Milestone changed from Awaiting Review to 4.9
  • Owner set to westonruter
  • Status changed from new to accepted

This makes sense to me.

#2 @westonruter
7 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 41372:

Customize: Align behavior of WP_Customize_Manager::save_changeset_post() with wp_insert_post() by setting status to future if supplied status is publish but date is future.

Props dlh.
Fixes #41336.

Note: See TracTickets for help on using tickets.