Searching a hook which triggers when deleting a post to get all comments

When deleting a post, all comments associated with this post get the status “post-trashed”. I’m searching a hook for this event.

Tried these one without success:
comment_approved_to_post-trashed
comment_approved_to_trash

2 Answers
2

There are few other hooks to manipulated the trashed comment.

  1. ‘save_post’: called after post is saved. You can check status of the post and manipulate its comment accordingly.
  2. ‘trashed_comment’: called after comment is moved to trash status.
  3. ‘transition_comment_status’: called whenever comment status is changed.

There are probably few others too. But, it depends what you want to do with the trashed comments.

Leave a Comment