How to change comment reply link text in wordpress?

I had to do that and had spent some time till I found/figured out how to do it without modifying wordpress core files. There are some information on the internet, but I think I will write it in the way it is more understandable for me, maybe for someone it will be usefull as well.

I was using theme which had a file comments.php in its root directory. So I guess the good chance is that your theme also will have this.

In comments.php there is a function

wp_list_comments('avatar_size=70&callback=custom_comment&type=comment');

of course parameters could be different or the function can be even without them. As you can see there is one parameter called ‘callback’. This is the function which overrides the appearance of comment. In our case the function is named ‘custom_comment’ but you can use your own name.

Now we must have that function, or it could have came already with a theme. In my case it came with a theme and it was placed in themes directory includes/theme_comments.php. Probably in another theme this might be something similar. It looked something like this (now its modified by me):

// Fist full of comments
function custom_comment($comment, $args, $depth) {
   $GLOBALS['comment'] = $comment; ?>
 
	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
 
    	<a name="comment-<?php comment_ID() ?>"></a>
 
      	<div class="comment-container">
 
			<?php if(get_comment_type() == "comment"){ ?>
 
            <div class="avatar"><?php the_commenter_avatar($args) ?></div>
 
            <?php } ?>
 
            <div class="comment-right">
 
                <div class="comment-head">
 
                    <span class="name fl"><?php the_commenter_link() ?></span>
 
                    <?php if(get_comment_type() == "comment"){ ?>
 
                        <span class="reply fr"><?php comment_reply_link(array_merge( $args, array('reply_text' => 'Atsakyti' ,'depth' => $depth, 'max_depth' => $args['max_depth']))) ?></span><!-- /.reply -->
                        <span class="date fr"><a href="<?php echo get_comment_link(); ?>" title="<?php _e('Direct link to this comment', 'woothemes'); ?>"><?php echo get_comment_date(get_option('date_format')) ?> <?php _e('at', 'woothemes'); ?> <?php echo get_comment_time(); ?></a></span>
                    <?php }?>
                        <span class="edit fr"><?php edit_comment_link('Edit &nbsp;', '', ''); ?></span>
 
                </div><!-- /.comment-head -->
 
                <div class="comment-entry"  id="comment-<?php comment_ID(); ?>">
 
                    <?php comment_text() ?>
 
                    <?php if ($comment->comment_approved == '0') { ?>
                        <p class='unapproved'><?php _e('Your comment is awaiting moderation.', 'woothemes'); ?></p>
                    <?php } ?>
 
 
                </div><!-- /comment-entry -->
 
            </div><!-- /comment-right -->
 
		</div><!-- /.comment-container -->
 
 
<?php
}

There is a called function comment_reply_link() – as you can see in the array there is item ‘reply_text’ with a value. So change that value by your needs and thats it :)

You also might not see that item, because it is optional, in my case I had to add it myself too. If you want to see all the posible parameters, you can go to wordpress core files – directory includes/comment-template.php and look at the function

get_comment_reply_link()

there is an array $defaults and there are all posible variables, in case you don’t like default values.

Also there is one another, more simple thing, but I will still tell it – you might want to change the text of cancel comment reply link.
So if you want to do that – open comments.php in your theme directory and find a function

cancel_comment_reply_link

and its parameter is string (optional). So if you put some string, it will replace the default text. (It probably is a chance that there is no such function in your theme, but I am not sure, because I myself still haven’t worked too much with wordpress).

8 Responses to “How to change comment reply link text in wordpress?”

  • Felipe says:

    Hi buddy,
    When I set the declaration for a Reply linkin, in my own theme, I get the following message:

    WARNING: ARRAY_MERGE() [FUNCTION.ARRAY-MERGE]: ARGUMENT #1 IS NOT AN ARRAY IN C:\WAMP\WWW\WORDPRESS\WP-CONTENT\THEMES\NICOLASGOLUB\COMMENTS.PHP ON LINE 9.

    I did’nt changed the declaration. It matchs with the one of your post:

    ‘Atsakyti’ ,’depth’ => $depth, ‘max_depth’ => $args['max_depth']))) ?>

    Do you know why is it happening?
    Thanks

    • SPeed_FANat1c says:

      Have no idea now, haven’t worked with wordpress probably for a year. Mostly working on codeigniter.

      But thanks for probably first non spam comment, nice to see :)

  • Johne469 says:

    I was just seeking this info for some time. After six hours of continuous Googleing, at last I got it in your web site. I wonder what is the lack of Google strategy that don’t rank this kind of informative websites in top of the list. Generally the top sites are full of garbage. eefbecaeakbk

    • SPeed_FANat1c says:

      Wow, that is sick. As we see I am lazy to put more new information to the blog. But its so nice that my information could be usefull for someone :)

      And actually – not all people leave the comments, so I should probably add some voting like in stack overflow so I could see which of my posts are usefull.

      Oh btw what else surprises me – the wordpress is updating constantly so this could work only for old versions, I don’t know if this would work for new one.

      But thanks for comment :)

  • SPeed_FANat1c says:

    And about google – I think that my site is hidden because I do not add new articles.

  • Want to get muscles fast and become like a beast?
    No need to wait months and months, get the pro Muscle Boosting BodyBuilding Supplements!

    Try it today More info

    FEEL YOUNG AGAIN!
    Restore your youthful energy – Use Creatine that fires up your training and helps to build muscles fast!

  • MaciekTib says:

    Kamera sportowa w gory? Kamera Eken cena Jaka kamera na narty?

Leave a Reply for SPeed_FANat1c