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
查看更多 >