检索Post Global唯一标识符(guid)。
原型
get_the_guid( int|WP_Post $post )
描述
guid似乎是一个链接,但不应该用作帖子的链接。你不应将其用作链接的原因是因为跨域移动博客。
参数
$post
(int|WP_Post)
(Optional)
帖子ID或帖子对象。默认为全球$ post。
返回值
(string)
源文件
路径:wp-includes/post-template.php
<?php
...
function get_the_guid( $post = 0 ) {
$post = get_post( $post );
$guid = isset( $post->guid ) ? $post->guid : '';
$id = isset( $post->ID ) ? $post->ID : 0;
/**
* Filters the Global Unique Identifier (guid) of the post.
*
* @since 1.5.0
*
* @param string $guid Global Unique Identifier (guid) of the post.
* @param int $id The post ID.
*/
return apply_filters( 'get_the_guid', $guid, $id );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_the_guid/