Skip to:
Content

bbPress.org

Opened 5 months ago

#3433 new defect (bug)

Restoring a trashed topic will set the post status to 'draft' as of WordPress 5.6.0

Reported by: r-a-y Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 2.6.6
Component: General Keywords:
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 (1)

3433.01.patch (3.4 KB) - added by r-a-y 5 months ago.

Download all attachments as: .zip

Change History (1)

@r-a-y
5 months ago

Note: See TracTickets for help on using tickets.