the_guid

函式
the_guid ( $post = 0 )
引數
  • (int|WP_Post) $post Optional. Post ID or post object. Default is global $post.
    Required:
定義位置
相關方法
the_idget_the_guidthe_author_idthe_widgetget_the_id
引入
1.5.0
棄用
-

the_guid – 這個函式用來輸出一個文章或頁面的全球唯一識別符號(GUID)。GUID是文章或頁面的唯一識別符號,通常用於RSS饋送。

顯示文章的全球唯一識別符號(guidfier)。

指南將顯示為一個連結,但不應該被用作文章的連結。你不應該把它作為連結使用的原因,是由於跨域移動部落格。

URL被轉義以使它對XML安全。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function the_guid( $post = 0 ) {
$post = get_post( $post );
$post_guid = isset( $post->guid ) ? get_the_guid( $post ) : '';
$post_id = isset( $post->ID ) ? $post->ID : 0;
/**
* Filters the escaped Global Unique Identifier (guid) of the post.
*
* @since 4.2.0
*
* @see get_the_guid()
*
* @param string $post_guid Escaped Global Unique Identifier (guid) of the post.
* @param int $post_id The post ID.
*/
echo apply_filters( 'the_guid', $post_guid, $post_id );
}
function the_guid( $post = 0 ) { $post = get_post( $post ); $post_guid = isset( $post->guid ) ? get_the_guid( $post ) : ''; $post_id = isset( $post->ID ) ? $post->ID : 0; /** * Filters the escaped Global Unique Identifier (guid) of the post. * * @since 4.2.0 * * @see get_the_guid() * * @param string $post_guid Escaped Global Unique Identifier (guid) of the post. * @param int $post_id The post ID. */ echo apply_filters( 'the_guid', $post_guid, $post_id ); }
function the_guid( $post = 0 ) {
	$post = get_post( $post );

	$post_guid = isset( $post->guid ) ? get_the_guid( $post ) : '';
	$post_id   = isset( $post->ID ) ? $post->ID : 0;

	/**
	 * Filters the escaped Global Unique Identifier (guid) of the post.
	 *
	 * @since 4.2.0
	 *
	 * @see get_the_guid()
	 *
	 * @param string $post_guid Escaped Global Unique Identifier (guid) of the post.
	 * @param int    $post_id   The post ID.
	 */
	echo apply_filters( 'the_guid', $post_guid, $post_id );
}

常見問題

FAQs
檢視更多 >