How to Customize Reply Link in WordPress Comment

In most WordPress sites, you may notice a Reply link under each comment. This allows you to reply other person’s comment easily. Here’s an example from Twenty Twelve theme:

reply link

In this tutorial, I’ll show you how to easily customize the reply link or replace the “Reply” word with your own word. WordPress has a filter called comment_reply_link. This filter accepts few arguments and you may find them from WordPress Codex. If you simply want to replace the “Reply” word with your own words, here’s a working WordPress snippet that can be placed on your theme’s functions.php file.

1 2 3 4 5 6 7 8
<?php
// Modify the Reply link
function afn_custom_comment_reply($link) {
$link = str_replace('Reply', 'Reply to this comment', $link);
return $link;
}
add_filter('comment_reply_link', 'afn_custom_comment_reply');
view raw functions.php hosted with ❤ by GitHub

What the code does is basically replacing the word “Reply” to “Reply to this comment” phrase. You may change the phrase as needed.

If you’ve any question, feel free to drop you comment below. If you’re looking for more awesome WordPress snippet, take a look at our WordPress Snippets archive page.

Comments

  1. Chitraparna says

    After Syed Balkhi’s WP Beginner, your blog is turning out to be my next favorite spot.

    I don’t know who you’re and the reason for this anonymity but you’re creating an amazingly resourceful site.

    • Editor says

      Hi Chitraparna,

      Thanks for the compliment. No, we’re not going to be anonymous or any of that kind. We’re still working on redesigning our site and once it’s completed, we’ll put together the About Us, Disclaimer and other important pages ;)

Leave a Reply

Your email address will not be published. Required fields are marked *