WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#37366 new defect (bug)

Restoring a scheduled post can cause it to be published

Reported by: danielbachhuber Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: needs-patch dev-feedback
Focuses: Cc:

Description

If you restore a scheduled post, the post will be published if the scheduled date has already passed.

As a user, I'd expect a scheduled post to remain a draft when restored from the trash.

Steps to reproduce:

  1. Create a new post.
  2. Schedule the post to be published two minutes in the future.
  3. Trash the post.
  4. Wait three minutes.
  5. Restore the post from the trash.
  6. Look at the post to see that it's been published.

There are a few existing related tickets #23022, #19907, #22350, #18362 that haven't seen much movement. However, I think this particular issue is more egregious than the others because the user accidentally publishes content they didn't mean to publish. On higher profile sites, particularly where there are distribution mechanisms hooked into the publishing process, this bug can have a severely negative impact (for instance, accidentally publishing an embargoed post that still wasn't safe to publish).

The solution will be to clear the post date value, but I'm undecided as to whether we should do that when a scheduled post is trashed, or when it's restored from the trash.

Change History (2)

#1 @lukecavanagh
2 years ago

@danielbachhuber

Makes sense to default that post status back to draft.

#2 @mbijon
2 years ago

Doing something a user doesn't expect definitely makes this worth prioritizing. Clearing the scheduled post date seems like an easy fix too.

Only things I'd suggest are:

  • Show an in-admin alert to the effect of "Doing this will/has clear(ed) the scheduled post date."
  • Add an action so devs can detect & use this event from custom schedulers
Note: See TracTickets for help on using tickets.