When sending a comment to the bin, the attached “comment replies” does not get trashed or deleted.
How can you configure wordpress so that when you trash a comment, the comment replies automatically gets deleted?
When sending a comment to the bin, the attached “comment replies” does not get trashed or deleted.
How can you configure wordpress so that when you trash a comment, the comment replies automatically gets deleted?
Comments are closed.
You could build an action for
delete_comment
, where you loop through the childcomments and delete them.I use two different functions here, one that trashes the childcomments (hooked into
trash_comment
), and one that deletes them directly.Please make sure which funtion you use, or if you want to use both. The safe version would be to move the childcomments to trash, not delete them in the first place – in this case you have to hook
f711_trash_child_comments
todelete_comment
.Please be aware that this function is fully recursive. The actions get called before the comment is actually deleted, so in a timeline the nested comments get deleted first, from the bottom level up.