[wp-trac] [WordPress Trac] #23022: Always set posts to draft status when untrashing
WordPress Trac
noreply at wordpress.org
Sun Sep 20 20:27:55 UTC 2020
#23022: Always set posts to draft status when untrashing
--------------------------------------+-----------------------------
Reporter: harrym | Owner: johnbillion
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 5.6
Component: Posts, Post Types | Version: 2.9
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: administration
--------------------------------------+-----------------------------
Changes (by johnbillion):
* keywords: has-patch needs-testing has-unit-tests => has-patch has-unit-
tests
Comment:
I refreshed the most recent patch. As a reminder, this:
* Switches to always restoring posts from the trash as a draft
* Adds a `wp_untrash_post_status` filter to change this behaviour
* Restores a post to its original status when the user hits `Undo` after
trashing a post
* Adds tests
Additionally in [attachment:"23022.diff"]:
* Adds the `$previous_status` parameter to the various hooks inside
`wp_untrash_post()`
* Adds an `Edit Post` link to the confirmation message after restoring a
single post from the trash (see #50618)
* Fixes an existing issue in `wp_untrash_post()` where `$post_id` might
remain as `0` in the unlikely event the function is called without a
`$post_id` parameter
To recap some reasons why making this change is a good idea:
* Restoring a previously published post causes it to be re-published
* Restoring a scheduled post can cause it to be published (#37366)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/23022#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list