[wp-trac] [WordPress Trac] #41336: Changeset saved with `publish` status and future date is not scheduled
WordPress Trac
noreply at wordpress.org
Sat Jul 15 17:09:57 UTC 2017
#41336: Changeset saved with `publish` status and future date is not scheduled
--------------------------+-----------------------------
Reporter: dlh | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.7
Severity: normal | Keywords: has-patch
Focuses: |
--------------------------+-----------------------------
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`: https://github.com/WordPress/WordPress/blob/4.8-branch/wp-
includes/post.php#L3161
whereas `save_changeset_post()` resets the date and publishes the
changeset immediately:
https://github.com/WordPress/WordPress/blob/4.8-branch/wp-includes/class-
wp-customize-manager.php#L2510
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41336>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list