comment_link

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

WordPress Version: 6.1

/**
 * Displays the link to the comments.
 *
 * @since 1.5.0
 * @since 4.4.0 Introduced the `$comment` argument.
 *
 * @param int|WP_Comment $comment Optional. Comment object or ID. Defaults to global comment object.
 */
function comment_link($comment = null)
{
    /**
     * Filters the current comment's permalink.
     *
     * @since 3.6.0
     *
     * @see get_comment_link()
     *
     * @param string $comment_permalink The current comment permalink.
     */
    echo esc_url(apply_filters('comment_link', get_comment_link($comment)));
}

WordPress Version: 5.5

/**
 * Display the link to the comments.
 *
 * @since 1.5.0
 * @since 4.4.0 Introduced the `$comment` argument.
 *
 * @param int|WP_Comment $comment Optional. Comment object or ID. Defaults to global comment object.
 */
function comment_link($comment = null)
{
    /**
     * Filters the current comment's permalink.
     *
     * @since 3.6.0
     *
     * @see get_comment_link()
     *
     * @param string $comment_permalink The current comment permalink.
     */
    echo esc_url(apply_filters('comment_link', get_comment_link($comment)));
}

WordPress Version: 4.6

/**
 * Display the link to the comments.
 *
 * @since 1.5.0
 * @since 4.4.0 Introduced the `$comment` argument.
 *
 * @param int|WP_Comment $comment Optional. Comment object or id. Defaults to global comment object.
 */
function comment_link($comment = null)
{
    /**
     * Filters the current comment's permalink.
     *
     * @since 3.6.0
     *
     * @see get_comment_link()
     *
     * @param string $comment_permalink The current comment permalink.
     */
    echo esc_url(apply_filters('comment_link', get_comment_link($comment)));
}

WordPress Version: 4.4

/**
 * Display the link to the comments.
 *
 * @since 1.5.0
 * @since 4.4.0 Introduced the `$comment` argument.
 *
 * @param int|WP_Comment $comment Optional. Comment object or id. Defaults to global comment object.
 */
function comment_link($comment = null)
{
    /**
     * Filter the current comment's permalink.
     *
     * @since 3.6.0
     *
     * @see get_comment_link()
     *
     * @param string $comment_permalink The current comment permalink.
     */
    echo esc_url(apply_filters('comment_link', get_comment_link($comment)));
}

WordPress Version: 3.9

/**
 * Display the link to the comments.
 *
 * @since 1.5.0
 */
function comment_link()
{
    /**
     * Filter the current comment's permalink.
     *
     * @since 3.6.0
     *
     * @see get_comment_link()
     *
     * @param string $comment_permalink The current comment permalink.
     */
    echo esc_url(apply_filters('comment_link', get_comment_link()));
}

WordPress Version: 3.7

/**
 * Display the link to the comments.
 *
 * @since 1.5.0
 */
function comment_link()
{
    echo esc_url(apply_filters('comment_link', get_comment_link()));
}