get_the_guid

函数
get_the_guid ( $post = 0 )
参数
  • (int|WP_Post) $post Optional. Post ID or post object. Default is global $post.
    Required:
返回值
  • (string)
定义位置
相关方法
get_the_idthe_guidget_the_author_idget_the_dateget_the_tags
引入
1.5.0
弃用
-

get_the_guid: 该函数检索当前文章或页面的全球唯一标识符(GUID)。它不接受任何参数,以字符串形式返回GUID。

检索文章的全球唯一标识符(guid)。

该指南将显示为一个链接,但不应该被用作文章的链接。你不应该把它作为一个链接,原因是要跨域移动博客。

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

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

	/**
	 * Filters the Global Unique Identifier (guid) of the post.
	 *
	 * @since 1.5.0
	 *
	 * @param string $post_guid Global Unique Identifier (guid) of the post.
	 * @param int    $post_id   The post ID.
	 */
	return apply_filters( 'get_the_guid', $post_guid, $post_id );
}

常见问题

FAQs
查看更多 >