I am writing a plugin that creates an api for a custom post type.
Users can comments on the custom post types and the comments are added using WP core comment methods.
My question arises when trying to deal with what to do when deleting a comment.
I understand what methods to use, but my question is more about the general procedure.
When you make a comment it can be a reply to another comment. If the parent commenter decides to delete their comment, what should be done with replies? Should they be deleted as well?
Should their parent pointer just move one up the tree?
You could also replace the deleted comment content with a message like, ‘Comment deleted’. Like a placeholder. Then the replies could keep the same parent pointer, but they would lose the context of the original parent comment’s content.
Am I overthinking this?
Do not delete the comment. One comment could have multiple children, and moving the replies up would create a false impression in any case.
The real question here is why someone wants to delete a comment and how you could react:
In any case, I would require a reason for deletion request, and create a separate comment review queue. Use comment meta fields for that.