Title: get_comment_guid
Published: April 25, 2014
Last modified: May 20, 2026

---

# get_comment_guid( int|WP_Comment $comment_id = null ): string|false

## In this article

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

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

Retrieves the feed GUID for the current comment.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_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`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_comment_guid/?output_format=md#return)󠁿

 string|false GUID for comment on success, false on failure.

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

    ```php
    function get_comment_guid( $comment_id = null ) {
    	$comment = get_comment( $comment_id );

    	if ( ! is_object( $comment ) ) {
    		return false;
    	}

    	return get_the_guid( $comment->comment_post_ID ) . '#comment-' . $comment->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/7.0/src/wp-includes/feed.php#L291)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/feed.php#L291-L299)

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

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

Retrieves the Post Global Unique Identifier (guid).

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

Retrieves comment data given a comment ID or comment object.

  |

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

Displays the feed GUID for the current comment.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_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%2Fget_comment_guid%2F)
before being able to contribute a note or feedback.