get_comment_guid

函式
get_comment_guid ( $comment_id = null )
引數
  • (int|WP_Comment) $comment_id Optional comment object or ID. Defaults to global comment object.
    Required:
    Default: null
返回值
  • (string|false) GUID for comment on success, false on failure.
定義位置
相關方法
get_comment_idcomment_guidget_commentget_comment_timeget_comment_date
引入
2.5.0
棄用
-

get_comment_guid – 這個函式返回一個評論的唯一識別符號。它通常是一個連結到評論的URL,並用於像RSS提要這樣的事情。它把評論的ID作為一個引數。

檢索當前評論的feed GUID。

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

常見問題

FAQs
檢視更多 >