function wp_get_post_parent_id( $post_ID ) {}

Returns the post’s parent’s post_ID


  • int $post_id
  • $post_ID

Return values

returns:false on error

Source code

function wp_get_post_parent_id( $post_ID ) {

	$post = get_post( $post_ID );

	if ( !$post || is_wp_error( $post ) )

		return false;

	return (int) $post->post_parent;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: