在创建\编码wordpress主题时获取“未定义函数get_post_ancestor()”

I am trying to create a wordpress theme through one of the tutorials on "https://www.youtube.com/watch?v=GHTZn3atTcM". Here I am trying to add a child-nav under the header-nav like a breadcrumb.

In my page.php I have my below piece of code:

<!-- Child nav -->
<?php
    $args = array(
        'child_of' => get_top_ancestor_id(),
        'title_li' => '' //single quotes
    );
    wp_list_pages($args); ?>

In my functions.php I have my below piece of code:

/* Get top ancestor id */
function get_top_ancestor_id(){

    global $post;

    if($post->post_parent){
        $ancestor = array_reverse(get_post_ancestor($post->ID));
        $ancestor[0];
    }
    return $post->ID;

}

Please suggest.

My bad, it must have been "get_post_ancestors()".