How to change things on the comment template

In my case, I wanted to change the text in the new threaded comments from “Reply” to “Reply to this comment” – sounds simple enough, right?

First: Grab the example function from this Codex page and add it to your theme’s functions.php file, changing the function name to suit.

Next: Locate the wp_list_comments function call in your theme’s comments.php file. If you don’t see it there you’ll need to consult the Codex to get your theme up to date. Once you’ve found or added that function call, change it to use your new custom function instead of the default, like this:


Finally: It’s clear enough how to modify the function to do some things, but in my case I wanted WP’s comment_reply_link function to display “Reply to this comment” instead of just “Reply” – it’s not clear how to do that though. The example function takes some arguments, so I decided to poke around to see if maybe it accepts more. Turns out you can set a custom reply_text by adding to the array of arguments like this:

comment_reply_link(array_merge( $args, array('reply_text' => 'Reply to this comment', 'depth' => $depth, 'max_depth' => $args['max_depth'])))

Other defaults include: add_below, respond_id, login_text, depth before after. Not sure what they all do yet…

Update: The get_avatar call in the example function from the Codex has a placeholder $default set, so it doesn’t work right for users without gravatar accounts. I just removed the placeholder so my get_avatar call looks like this instead:

< ?php echo get_avatar($comment,$size='48'); ?>

Avatar photo

By isaac

I like cats. he/him