has_post_parent( int|WP_Post|null $post = null )

Returns whether the given post has a parent post.

Parameters Parameters


(int|WP_Post|null) (Optional) Post ID or WP_Post object. Default is global $post.

Default value: null

Top ↑

Return Return

(bool) Whether the post has a parent post.

Top ↑

Source Source

File: wp-includes/post-template.php

function has_post_parent( $post = null ) {
	return (bool) get_post_parent( $post );

Top ↑

Changelog Changelog

Version Description
5.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

Top ↑

You must log in before being able to contribute a note or feedback.