Title: comment_guid
Published: April 25, 2014
Last modified: April 28, 2025

---

# comment_guid( int|WP_Comment $comment_id = null )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/comment_guid/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/comment_guid/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/comment_guid/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/comment_guid/?output_format=md#changelog)

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

Displays the feed GUID for the current comment.

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

 `$comment_id`int|[WP_Comment](https://developer.wordpress.org/reference/classes/wp_comment/)
optional

Optional comment object or ID. Defaults to global comment object.

Default:`null`

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

    ```php
    function comment_guid( $comment_id = null ) {
    	echo esc_url( get_comment_guid( $comment_id ) );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/feed.php#L279)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/feed.php#L279-L281)

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

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

Retrieves the feed GUID for the current comment.

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

Checks and cleans a URL.

  |

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

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

## User Contributed Notes

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