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

In this article

Retrieves the feed GUID for the current comment.

Parameters

$comment_idint|WP_Commentoptional
Optional comment object or ID. Defaults to global comment object.

Default:null

Return

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

Source

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;
}

Changelog

VersionDescription
2.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.