get_comment_guid() WordPress Function

The get_comment_guid() function in WordPress returns the global identifier for the comment. This can be useful for syndication purposes.

get_comment_guid( int|WP_Comment $comment_id = null ) #

Retrieve the feed GUID for the current comment.


Parameters

$comment_id

(int|WP_Comment)(Optional)comment object or ID. Defaults to global comment object.

Default value: null


Top ↑

Return

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


Top ↑

Source

File: wp-includes/feed.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;
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.