get_comment_reply_link

The timeline below displays how wordpress function get_comment_reply_link has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Retrieves HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array          $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Optional. Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Optional. Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. %s: Comment author name. */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($comment)) {
        return;
    }
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    if (get_option('page_comments')) {
        $permalink = str_replace('#comment-' . $comment->comment_ID, '', get_comment_link($comment));
    } else {
        $permalink = get_permalink($post->ID);
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $data_attributes = array('commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id'], 'replyto' => sprintf($args['reply_to_text'], get_comment_author($comment)));
        $data_attribute_string = '';
        foreach ($data_attributes as $name => $value) {
            $data_attribute_string .= " data-{$name}=\"" . esc_attr($value) . '"';
        }
        $data_attribute_string = trim($data_attribute_string);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url(add_query_arg(array('replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false), $permalink)) . '#' . $args['respond_id'], $data_attribute_string, esc_attr(sprintf($args['reply_to_text'], get_comment_author($comment))), $args['reply_text']);
    }
    $comment_reply_link = $args['before'] . $link . $args['after'];
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string     $comment_reply_link The HTML markup for the comment reply link.
     * @param array      $args               An array of arguments overriding the defaults.
     * @param WP_Comment $comment            The object of the comment being replied.
     * @param WP_Post    $post               The WP_Post object.
     */
    return apply_filters('comment_reply_link', $comment_reply_link, $args, $comment, $post);
}

WordPress Version: 6.2

/**
 * Retrieves HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array          $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Optional. Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Optional. Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. %s: Comment author name. */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($comment)) {
        return;
    }
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    if (get_option('page_comments')) {
        $permalink = str_replace('#comment-' . $comment->comment_ID, '', get_comment_link($comment));
    } else {
        $permalink = get_permalink($post->ID);
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $data_attributes = array('commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id'], 'replyto' => sprintf($args['reply_to_text'], get_comment_author($comment)));
        $data_attribute_string = '';
        foreach ($data_attributes as $name => $value) {
            $data_attribute_string .= " data-{$name}=\"" . esc_attr($value) . '"';
        }
        $data_attribute_string = trim($data_attribute_string);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url(add_query_arg(array('replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false), $permalink)) . '#' . $args['respond_id'], $data_attribute_string, esc_attr(sprintf($args['reply_to_text'], get_comment_author($comment))), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string     $link    The HTML markup for the comment reply link.
     * @param array      $args    An array of arguments overriding the defaults.
     * @param WP_Comment $comment The object of the comment being replied.
     * @param WP_Post    $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 5.9

/**
 * Retrieves HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array          $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. %s: Comment author name. */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($comment)) {
        return;
    }
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    if (get_option('page_comments')) {
        $permalink = str_replace('#comment-' . $comment->comment_ID, '', get_comment_link($comment));
    } else {
        $permalink = get_permalink($post->ID);
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $data_attributes = array('commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id'], 'replyto' => sprintf($args['reply_to_text'], get_comment_author($comment)));
        $data_attribute_string = '';
        foreach ($data_attributes as $name => $value) {
            $data_attribute_string .= " data-{$name}=\"" . esc_attr($value) . '"';
        }
        $data_attribute_string = trim($data_attribute_string);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url(add_query_arg(array('replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false), $permalink)) . '#' . $args['respond_id'], $data_attribute_string, esc_attr(sprintf($args['reply_to_text'], get_comment_author($comment))), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string     $link    The HTML markup for the comment reply link.
     * @param array      $args    An array of arguments overriding the defaults.
     * @param WP_Comment $comment The object of the comment being replied.
     * @param WP_Post    $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 5.8

/**
 * Retrieves HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array          $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. %s: Comment author name. */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($comment)) {
        return;
    }
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    if (get_option('page_comments')) {
        $permalink = str_replace('#comment-' . $comment->comment_ID, '', get_comment_link($comment));
    } else {
        $permalink = get_permalink($post->ID);
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $data_attributes = array('commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id'], 'replyto' => sprintf($args['reply_to_text'], $comment->comment_author));
        $data_attribute_string = '';
        foreach ($data_attributes as $name => $value) {
            $data_attribute_string .= " data-{$name}=\"" . esc_attr($value) . '"';
        }
        $data_attribute_string = trim($data_attribute_string);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url(add_query_arg(array('replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false), $permalink)) . '#' . $args['respond_id'], $data_attribute_string, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string     $link    The HTML markup for the comment reply link.
     * @param array      $args    An array of arguments overriding the defaults.
     * @param WP_Comment $comment The object of the comment being replied.
     * @param WP_Post    $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 5.5

/**
 * Retrieves HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array          $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. %s: Comment author name. */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($comment)) {
        return;
    }
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $data_attributes = array('commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id'], 'replyto' => sprintf($args['reply_to_text'], $comment->comment_author));
        $data_attribute_string = '';
        foreach ($data_attributes as $name => $value) {
            $data_attribute_string .= " data-{$name}=\"" . esc_attr($value) . '"';
        }
        $data_attribute_string = trim($data_attribute_string);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url(add_query_arg(array('replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false), get_permalink($post->ID))) . '#' . $args['respond_id'], $data_attribute_string, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string     $link    The HTML markup for the comment reply link.
     * @param array      $args    An array of arguments overriding the defaults.
     * @param WP_Comment $comment The object of the comment being replied.
     * @param WP_Post    $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 5.4

/**
 * Retrieves HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. %s: Comment author name. */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($comment)) {
        return;
    }
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $data_attributes = array('commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id']);
        $data_attribute_string = '';
        foreach ($data_attributes as $name => $value) {
            $data_attribute_string .= " data-{$name}=\"" . esc_attr($value) . '"';
        }
        $data_attribute_string = trim($data_attribute_string);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url(add_query_arg(array('replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false), get_permalink($post->ID))) . '#' . $args['respond_id'], $data_attribute_string, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string     $link    The HTML markup for the comment reply link.
     * @param array      $args    An array of arguments overriding the defaults.
     * @param WP_Comment $comment The object of the comment being replied.
     * @param WP_Post    $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 5.3

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. %s: Comment author name. */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($comment)) {
        return;
    }
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $data_attributes = array('commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id']);
        $data_attribute_string = '';
        foreach ($data_attributes as $name => $value) {
            $data_attribute_string .= " data-{$name}=\"" . esc_attr($value) . '"';
        }
        $data_attribute_string = trim($data_attribute_string);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url(add_query_arg(array('replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false), get_permalink($post->ID))) . '#' . $args['respond_id'], $data_attribute_string, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 5.1

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return void|false|string Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. %s: Comment author name */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $data_attributes = array('commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id']);
        $data_attribute_string = '';
        foreach ($data_attributes as $name => $value) {
            $data_attribute_string .= " data-{$name}=\"" . esc_attr($value) . '"';
        }
        $data_attribute_string = trim($data_attribute_string);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url(add_query_arg(array('replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false))) . '#' . $args['respond_id'], $data_attribute_string, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 4.7

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $max_depth  The max depth of the comment tree. Default 0.
 *     @type int    $depth      The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return void|false|string Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array(
        'add_below' => 'comment',
        'respond_id' => 'respond',
        'reply_text' => __('Reply'),
        /* translators: Comment reply button text. 1: Comment author name */
        'reply_to_text' => __('Reply to %s'),
        'login_text' => __('Log in to Reply'),
        'max_depth' => 0,
        'depth' => 0,
        'before' => '',
        'after' => '',
    );
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $onclick = sprintf('return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )', $args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>", esc_url(add_query_arg('replytocom', $comment->comment_ID, get_permalink($post->ID))) . "#" . $args['respond_id'], $onclick, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 4.6

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $depth'     The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return void|false|string Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 'reply_to_text' => __('Reply to %s'), 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filters the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $onclick = sprintf('return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )', $args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>", esc_url(add_query_arg('replytocom', $comment->comment_ID, get_permalink($post->ID))) . "#" . $args['respond_id'], $onclick, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filters the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 4.4

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $depth'     The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int|WP_Comment $comment Comment being replied to. Default current comment.
 * @param int|WP_Post    $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                                Default current post.
 * @return void|false|string Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 'reply_to_text' => __('Reply to %s'), 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filter the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array      $args    Comment reply link arguments. See get_comment_reply_link()
     *                            for more information on accepted arguments.
     * @param WP_Comment $comment The object of the comment being replied to.
     * @param WP_Post    $post    The WP_Post object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $onclick = sprintf('return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )', $args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>", esc_url(add_query_arg('replytocom', $comment->comment_ID, get_permalink($post->ID))) . "#" . $args['respond_id'], $onclick, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filter the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 4.3

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $depth'     The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int         $comment Comment being replied to. Default current comment.
 * @param int|WP_Post $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                             Default current post.
 * @return void|false|string Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 'reply_to_text' => __('Reply to %s'), 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filter the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array   $args    Comment reply link arguments. See {@see get_comment_reply_link()}
     *                         for more information on accepted arguments.
     * @param object  $comment The object of the comment being replied to.
     * @param WP_Post $post    The {@see WP_Post} object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $onclick = sprintf('return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )', $args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID);
        $link = sprintf("<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>", esc_url(add_query_arg('replytocom', $comment->comment_ID, get_permalink($post->ID))) . "#" . $args['respond_id'], $onclick, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filter the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 4.1

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $depth'     The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int         $comment Comment being replied to. Default current comment.
 * @param int|WP_Post $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                             Default current post.
 * @return null|false|string Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 'reply_to_text' => __('Reply to %s'), 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    /**
     * Filter the comment reply link arguments.
     *
     * @since 4.1.0
     *
     * @param array   $args    Comment reply link arguments. See {@see get_comment_reply_link()}
     *                         for more information on accepted arguments.
     * @param object  $comment The object of the comment being replied to.
     * @param WP_Post $post    The {@see WP_Post} object.
     */
    $args = apply_filters('comment_reply_link_args', $args, $comment, $post);
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = sprintf('<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url(wp_login_url(get_permalink())), $args['login_text']);
    } else {
        $onclick = sprintf('return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )', $args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID);
        $link = sprintf("<a class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>", esc_url(add_query_arg('replytocom', $comment->comment_ID)) . "#" . $args['respond_id'], $onclick, esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)), $args['reply_text']);
    }
    /**
     * Filter the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 4.0

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $depth'     The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int         $comment Comment being replied to. Default current comment.
 * @param int|WP_Post $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                             Default current post.
 * @return mixed Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    $add_below = $args['add_below'];
    $respond_id = $args['respond_id'];
    $reply_text = $args['reply_text'];
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url(wp_login_url(get_permalink())) . '">' . $args['login_text'] . '</a>';
    } else {
        $link = "<a class='comment-reply-link' href='" . esc_url(add_query_arg('replytocom', $comment->comment_ID)) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"{$add_below}-{$comment->comment_ID}\", \"{$comment->comment_ID}\", \"{$respond_id}\", \"{$post->ID}\")'>{$reply_text}</a>";
    }
    /**
     * Filter the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post);
}

WordPress Version: 3.9

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
 *                              The resulting value is passed as the first parameter to addComment.moveForm(),
 *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
 *                              to addComment.moveForm(), and appended to the link URL as a hash value.
 *                              Default 'respond'.
 *     @type string $reply_text The text of the Reply link. Default 'Reply'.
 *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    $depth'     The depth of the new comment. Must be greater than 0 and less than the value
 *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
 *     @type string $before     The text or HTML to add before the reply link. Default empty.
 *     @type string $after      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int         $comment Comment being replied to. Default current comment.
 * @param int|WP_Post $post    Post ID or WP_Post object the comment is going to be displayed on.
 *                             Default current post.
 * @return mixed Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    extract($args, EXTR_SKIP);
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    $link = '';
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url(wp_login_url(get_permalink())) . '">' . $login_text . '</a>';
    } else {
        $link = "<a class='comment-reply-link' href='" . esc_url(add_query_arg('replytocom', $comment->comment_ID)) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"{$add_below}-{$comment->comment_ID}\", \"{$comment->comment_ID}\", \"{$respond_id}\", \"{$post->ID}\")'>{$reply_text}</a>";
    }
    /**
     * Filter the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $link    The HTML markup for the comment reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
}

WordPress Version: 3.7

/**
 * Retrieve HTML content for reply to comment link.
 *
 * @since 2.7.0
 *
 * @param array $args {
 *     Optional. Override default arguments.
 *
 *     @type string 'add_below'  The first part of the selector used to identify the comment to respond below. The resulting
 *                               value is passed as the first parameter to addComment.moveForm(), concatenated
 *                               as $add_below-$comment->comment_ID. Default 'comment'.
 *     @type string 'respond_id' The selector identifying the responding comment. Passed as the third parameter to addComment.moveForm(),
 *                               and appended to the link URL as a hash value. Default 'respond'.
 *     @type string 'reply_text' The text of the Reply link. Default 'Reply'.
 *     @type string 'login_text' The text of the link to reply if logged out. Default 'Log in to Reply'.
 *     @type int    'depth'      The depth of the new comment. Must be greater than 0 and less than the value of the 'thread_comments_depth'
 *                               option set in Settings > Discussion.
 *                               Default 0.
 *     @type string 'before'     The text or HTML to add before the reply link. Default empty.
 *     @type string 'after'      The text or HTML to add after the reply link. Default empty.
 * }
 * @param int         $comment Optional. Comment being replied to. Default current comment.
 * @param int|WP_Post $post    Optional. Post ID or WP_Post object the comment is going to be displayed on. Default current post.
 * @return mixed Link to show comment form, if successful. False, if comments are closed.
 */
function get_comment_reply_link($args = array(), $comment = null, $post = null)
{
    $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
    $args = wp_parse_args($args, $defaults);
    if (0 == $args['depth'] || $args['max_depth'] <= $args['depth']) {
        return;
    }
    extract($args, EXTR_SKIP);
    $comment = get_comment($comment);
    if (empty($post)) {
        $post = $comment->comment_post_ID;
    }
    $post = get_post($post);
    if (!comments_open($post->ID)) {
        return false;
    }
    $link = '';
    if (get_option('comment_registration') && !is_user_logged_in()) {
        $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url(wp_login_url(get_permalink())) . '">' . $login_text . '</a>';
    } else {
        $link = "<a class='comment-reply-link' href='" . esc_url(add_query_arg('replytocom', $comment->comment_ID)) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"{$add_below}-{$comment->comment_ID}\", \"{$comment->comment_ID}\", \"{$respond_id}\", \"{$post->ID}\")'>{$reply_text}</a>";
    }
    /**
     * Filter the comment reply link.
     *
     * @since 2.7.0
     *
     * @param string  $before  Text or HTML displayed before the reply link.
     * @param string  $link    The HTML markup for the comment reply link.
     * @param string  $after   Text or HTML displayed after the reply link.
     * @param array   $args    An array of arguments overriding the defaults.
     * @param object  $comment The object of the comment being replied.
     * @param WP_Post $post    The WP_Post object.
     */
    return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
}