Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply delete then restore doesn’t work anymore


  • maksanse
    Participant

    @maksanse

    Hello there,

    I just discovered a bug on bbpress (v2.6.9) : when you :

    1) trash a reply,
    2) then restore it,
    3) that reply is definitely trashed instead of being restored

    I reproduced this issue with wordpress default theme with no other plugins activated.

    Did you noticed that also ?

    Best regards

Viewing 6 replies - 1 through 6 (of 6 total)

  • Robin W
    Moderator

    @robin-w

    On my test site – it goes into being draft

    If you look at

    dashboard>replies>all replies

    you should see it as draft in there – I did an approve to get it back.

    Can you test that you get the same.

    If you are getting that as well, then I’ll take a look to see what the bug is, as agree it should work on the front end.


    maksanse
    Participant

    @maksanse

    Hello Robin and thank you for your quick answer 🙏
    You are right : replies were converted in draft 👍


    Robin W
    Moderator

    @robin-w

    ok I’ll take a look when I get a mo


    Robin W
    Moderator

    @robin-w

    I’ve just taken a look.

    bbpress uses the wordpress ‘untrash’ function to restore topics and replies.

    That wordpress function includes a note saying

    * By default posts that are restored will be assigned a status of 'draft'.
    * Prior to WordPress 5.6.0, restored posts were always assigned their original status.

    so this was a change in WordPress 5.6

    However WordPress helpfully includes a hook we can link to to restore the previous status automatically

    add_filter ('wp_untrash_post_status', 'wp_untrash_post_set_previous_status' , 10 , 3) ;

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets


    maksanse
    Participant

    @maksanse

    Thank you Robin for the filter ! That works great !
    I missed that change after the 5.6.0 version.

    Best regards


    Robin W
    Moderator

    @robin-w

    great – glad you are fixed 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar