函数原型
has_post_parent( int|WP_Post|null $post = null ): bool
函数描述
Returns whether the given post has a parent post.
是否弃用
未弃用
函数参数
-
$post
int|WP_Post|null
Optional - Post ID or WP_Post object. Default is global $post.
Default:
null
函数返回值
bool Whether the post has a parent post.
函数位置
File: wp-includes/post-template.php.
函数源码
function has_post_parent( $post = null ) {
return (bool) get_post_parent( $post );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.7.0 | Introduced. |

