has_post_parent

The timeline below displays how wordpress function has_post_parent has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.7

/**
 * Returns whether the given post has a parent post.
 *
 * @since 5.7.0
 *
 * @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return bool Whether the post has a parent post.
 */
function has_post_parent($post = null)
{
    return (bool) get_post_parent($post);
}