Title: comments_link
Published: April 25, 2014
Last modified: August 20, 2026

---

# comments_link( string $deprecated = '', string $deprecated_2 = '' )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#wp--skip-link--target)

Displays the link to the current post comments.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#parameters)󠁿

 `$deprecated`stringoptional

Not Used.

Default:`''`

`$deprecated_2`stringoptional

Not Used.

Default:`''`

## 󠀁[Source](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#source)󠁿

    ```php
    function comments_link( $deprecated = '', $deprecated_2 = '' ) {
    	if ( ! empty( $deprecated ) ) {
    		_deprecated_argument( __FUNCTION__, '0.72' );
    	}
    	if ( ! empty( $deprecated_2 ) ) {
    		_deprecated_argument( __FUNCTION__, '1.3.0' );
    	}
    	echo esc_url( get_comments_link() );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/comment-template.php#L896)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/comment-template.php#L896-L904)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#related)󠁿

| Uses | Description | 
| [get_comments_link()](https://developer.wordpress.org/reference/functions/get_comments_link/)`wp-includes/comment-template.php` |

Retrieves the link to the current post comments.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [_deprecated_argument()](https://developer.wordpress.org/reference/functions/_deprecated_argument/)`wp-includes/functions.php` |

Marks a function argument as deprecated and inform when it has been used.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#)

| Used by | Description | 
| [print_embed_comments_button()](https://developer.wordpress.org/reference/functions/print_embed_comments_button/)`wp-includes/embed.php` |

Prints the necessary markup for the embed comments button.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#changelog)󠁿

| Version | Description | 
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/comments_link/?output_format=md#comment-content-787)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/comments_link/#comment-787)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomments_link%2F%23comment-787)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomments_link%2F%23comment-787)
 4. Example
 5.     ```php
        <a href="<?php comments_link(); ?>">
            Comments to this post
        </a>
        ```
    
 6. Note: The output of `comments_link()` is already escaped by core.
 7.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomments_link%2F%3Freplytocom%3D787%23feedback-editor-787)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomments_link%2F)
before being able to contribute a note or feedback.