WPDev.one
Core Function
View Source on Trac ↗

get_post_parent()

get_post_parent( mixed $post = null )

Retrieves the parent post object for the given 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

((WP_Post)
| null) Parent post object, or null if there isn't one.

Function Information

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