get_post_parent
get_post_parent ( $post = null )
Parameters:- (int|WP_Post|null) post Optional. Post ID or WP_Post object. Default is global $post.
Returns:- (WP_Post|null) Parent post object, or null if there isn't one.
Defined at: - Introduced in WordPress: 5.7.0
- Deprecated in WordPress: —
Description
Retrieves the parent post object for the given post.