#3433 closed defect (bug) (fixed)
Restoring a trashed topic will set the post status to 'draft' as of WordPress 5.6.0
Reported by: | r-a-y | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 2.6.10 | Priority: | high |
Severity: | major | Version: | 2.6.6 |
Component: | API - Moderation | Keywords: | has-patch |
Cc: |
Description
If a topic is marked as 'trash'
and later an admin views the topic and clicks on the "Restore" link, the topic is saved with the post status of 'draft'
.
Consequently, it's not possible to view the topic on the frontend any more to modify the topic's status to something else.
The issue is WordPress 5.6.0 changed the behavior of what happens when a post is untrashed. Before, it would revert to the last-saved status, now all post types except attachment
will default to 'draft'
.
We have to utilize the new 'wp_untrash_post_status'
filter to fix this. See: https://github.com/WordPress/WordPress/blob/14f024a34ab50ab5a3cbd7db150d789e94adccf2/wp-includes/post.php#L3465-L3480
Attached patch fixes this and includes unit tests. Feel free to rename the bbp_use_previous_status_for_untrash()
function to something else.
Attachments (2)
Change History (7)
#2
@
3 years ago
- Component changed from General to API - Moderation
- Keywords has-patch added
- Owner set to johnjamesjacoby
- Priority changed from normal to high
- Status changed from new to assigned
#3
@
3 years ago
Thanks @r-a-y for the patch (and persistence 😬)
3433.02.patch iterates on 01 in the following ways:
- Rename new function
- Inline docs in new function
- Minor code formatting tweaks
- Default values for function, specifically to fallback to
pending
if something goes wrong
I've tested manually it by trashing & untrashing numerous topics and replies, and everything appears to be working as intended.
I'm adding this to the 2.6.10 milestone because this is a big bug in my eyes, but feel free to bump to another milestone.