I know that the code for the comment is generated in Walker_Comment::comment() and for html5 themes in the method Walker_Comment::html5_comment.

But if I try to copy the code from that last method it does not work because of obvious things like

$this->hasParent and so on. I can fix this by using $comment->hasParent

Isn't there somewhere a callback I can use which produces the exact same results as the standard code which will work out of the box?

I am using twenty seventeen and would like to change a few thing. I could hack the class-walker-comment.php but that would be a bad idea.


1 Answer 1


It sounds to me like you're wanting to extend the default comments walker with your own:

class My_Walker_Comment extends Walker_Comment {
  // giddy up

If so, this answer explains it quite well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.