WPDev.one
Core Function
View Source on Trac ↗

has_post_parent()

has_post_parent( mixed $post = null )

Returns whether the given post has a parent post.

Parameters 1 required

Name / Type Description
(int

| WP_Post | null) $post Optional. Post ID or WP_Post object. Default is global $post.

Required

Return Value

(bool)
Whether the post has a parent post.

Function Information

Since Version
5.7.0
Source File
wp-includes/post-template.php
Advertisement