[wp-trac] [WordPress Trac] #63931: Deleting a parent comment causes the child to move up a level

WordPress Trac noreply at wordpress.org
Sun Sep 14 22:56:56 UTC 2025


#63931: Deleting a parent comment causes the child to move up a level
---------------------------------------+-----------------------------
 Reporter:  oglekler                   |       Owner:  (none)
     Type:  enhancement                |      Status:  new
 Priority:  normal                     |   Milestone:  Future Release
Component:  Comments                   |     Version:
 Severity:  normal                     |  Resolution:
 Keywords:  has-test-info 2nd-opinion  |     Focuses:
---------------------------------------+-----------------------------

Comment (by SirLouen):

 Replying to [comment:19 peterwilsoncc]:
 > If the deleted comment is a child, then the thread would be detacted
 without retaining an object
 >
 > - Top level comment, ID 1
 >    - Deleted comment, parent 1, ID 2
 >       - Comment, parent 2, ID 3
 >
 > Without a placeholder for the deleted comment the continuation of the
 thread would become detached from comment one. The only way to accurately
 record a deleted comment would be to prevent the deletion of objects from
 the database.

 True, "cutting" the tree in the middle directly from the database, will
 provoke a detachment of nodes. This means that it will generate a new
 tree, where deleted ID2 is the new main parent, with a placeholder, and ID
 3 is the child of that placeholder.

 If you mess with the database and you end with broken hierarchies.

 And to avoid this from the logic on deletion (after trashing), we could
 introduce a `comment_type` called "placeholder" (to retain the hierarchy)

 Let's evaluate current behaviour:
 Parent ID 1
 Child A ID 2 Parent ID 1
 Child B ID 3 Parent ID 2

 If you delete a Child from the database, the whole subtree disappears.
 - Delete Child A from DB
 - Only Parent ID 1 displays
 - Child B ends detached but doesnt display anymore.

 If you trash and delete permanently from UI
 - Delete Child A from trash
 - Tree updates new Parent for Child B (ID 3) is Parent (ID 1), still a
 weak behaviour.

 Imagine this scenario:

 Parent ID 1: "I like playing Mario Kart, one of the best games in history"
 Child A ID 2 (Parent, ID 1): "This game has been one of the worst I've
 ever played"
 Child B ID 3 (Parent: ID 2): "I totally agree with you"

 A mod without agency, trashes Child A. And Trash is cleaned, making Child
 B parent ID 1. It will end looking like this:
 Parent ID 1: "I like playing Mario Kart, one of the best games in history"
 Child B ID 3 (Parent: ID 1): "I totally agree with you"

 Unfortunate sequence of comments, isn't it?

 With my algorithm it will look like:

 - Deletion from Trash:
 Parent ID 1: "I like playing Mario Kart, one of the best games in history"
 Child A ID 2: (`comment_type` = `placeholder`, Parent ID 1): "This comment
 has been deleted"
 Child B ID 3 Parent ID 2: "I totally agree with you"

 - Deletion from DB
 Parent ID 1: "I like playing Mario Kart, one of the best games in history"

 Parent ID N/A - "This comment has been deleted"
 Child B ID 3 Parent ID 2 (nonexistent): "I totally agree with you"

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63931#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list