WPDev.one
Core Function
View Source on Trac ↗

wp_get_post_parent_id()

wp_get_post_parent_id( mixed $post = null )

Returns the ID of the post's parent.

Parameters 1 required

Name / Type Description
(int

| WP_Post | null) $post Optional. Post ID or post object. Defaults to global $post.

Required

Return Value

((int)
(int | false) Post parent ID (which can be 0 if there is no parent), or false if the post does not exist.

Function Information

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