函数原型
get_the_guid( int|WP_Post $post ): string
函数描述
Retrieves the Post Global Unique Identifier (guid).
是否弃用
未弃用
函数参数
-
$post
int|WP_Post
Optional - Post ID or post object. Default is global $post.
函数返回值
string
函数位置
File: wp-includes/post-template.php.
函数源码
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 );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |

