[wp-trac] [WordPress Trac] #64016: Unnecessary HTML comments in the comments walker.

WordPress Trac noreply at wordpress.org
Sat Sep 20 07:07:15 UTC 2025


#64016: Unnecessary HTML comments in the comments walker.
-------------------------+-----------------------------
 Reporter:  edent        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Comments     |    Version:  6.8.2
 Severity:  trivial      |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 When `wp_list_comments()` uses the `ul` or `ol` style, the source-code of
 the page becomes littered with `<!-- .children -->` and `<!-- #comment-##
 -->`

 These are caused by
 [https://github.com/WordPress/WordPress/blob/69ced2eb1fc85ec5e106384b48c8015c77468402
 /wp-includes/class-walker-comment.php#L91 class-walker-comment.php#L91]
 and
 [https://github.com/WordPress/WordPress/blob/69ced2eb1fc85ec5e106384b48c8015c77468402
 /wp-includes/class-walker-comment.php#L238 #L238]

 This was
 [https://github.com/WordPress/WordPress/commit/b3f6427c6ff3fb6f4861a2f63e8439ea980e7f15
 introduced in 2013] with the comment "Some helpful HTML comments to help
 untangle the HTML".

 I'm not sure what utility these HTML comments add. They aren't targetted
 by any existing code that I can find. The HTML produced is fairly
 straightforward and doesn't need untangling.

 I plan to send a PR to remove the HTML comments from the output - unless
 anyone has strong feelings otherwise?

 *
 [https://wordpress.slack.com/archives/C02RQBWTW/p1758321415072609?thread_ts=1758316523.847199&cid=C02RQBWTW
 Discussion on Slack]
 * [https://mastodon.social/@Edent/115233058314937651 Discussion on
 Mastodon]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64016>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list