HTTP/2 301
server: nginx
date: Sat, 27 Dec 2025 04:41:21 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
vary: accept, content-type
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/functions/comment_link/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
HTTP/2 200
server: nginx
date: Sat, 27 Dec 2025 04:41:21 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
comment_link() – Function | Developer.WordPress.org
comment_link( int|WP_Comment $comment = null )
Displays the link to the comments.
$commentint|optionalComment object or ID. Defaults to global comment object.
Default:null
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 ) ) );
}
View all references View on Trac View on GitHub
| Version | Description |
|---|
| 4.4.0 | Introduced the $comment argument. |
| 1.5.0 | Introduced. |
Create an anchored permalink to a single comment.
The code shown above will result (depending on your permalink settings) in something like this: