Here are few ideas:
-
It’s possible to inject custom HTML or data attributes via the
comment_reply_linkfilter, but I think it would be better to keep it unobtrusive. -
One could try to get the comment parent value from the reply comment form:
<input type="hidden" name="comment_parent" id='comment_parent' value="0" />after it has been updated with the corresponding value.
-
Another approach would be to scan for IDs in the HTML of the comments list:
Generated by the
Walker_Comment::html5_comment():<li id="comment-34" class="comment even thread-even depth-1"> <article id="div-comment-34" class="comment-body"> ... cut...Generated by the
Walker_Comment::comment():<li class="comment even thread-even depth-1 parent" id="comment-34"> <div id="div-comment-34" class="comment-body"> ... cut...One could e.g. search for both cases, but it’s possible for the user to override these with a custom output.
Also note the
depthinformation here. -
One could try to parse the
onclickattribute of the replyto link:onclick='return addComment.moveForm( "div-comment-34", "34", "respond", "123" )'