WordPress at a glance
function is not described

wp_get_post_parent_id() WP 3.1.0

Returns the ID of the post's parent.

No Hooks.


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


wp_get_post_parent_id( $post );
$post(int|WP_Post) (required)
Post ID or post object.
Default: global $post


Since 3.1.0 Introduced.

Code of wp_get_post_parent_id() WP 5.7

function wp_get_post_parent_id( $post ) {
	$post = get_post( $post );
	if ( ! $post || is_wp_error( $post ) ) {
		return false;
	return (int) $post->post_parent;