WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Template Tags/get comments link

Description

The get_comments_link template tag returns the URL to the specified or current post's comments.

Use comments_link to echo the value for the current post.

Usage

 <?php get_comments_link$post_ID ); ?> 

Example

<a href="<?php echo get_comments_link( $post->ID ); ?>">
    Comments to this post
</a>

Parameters

post_ID
(integer) (optional) The ID of the post for which to print the comment's link.
Default: 0 (the current post)

Source Code

get_comments_link() is located in wp-includes/get_comment-template.php.

Related

Comments Functions

See also index of Function Reference and index of Template Tags.