Get a page ancestor from a most viewed list

get_ancestors will return array form value. So if you talking about how to get and display that ancestors with link: <?php $arrAncestors = get_ancestors( $post->ID, ‘page’); $cntAncestors = COUNT($arrAncestors); if($cntAncestors > 0) { $parentPostId = $arrAncestors[$cntAncestors – 1]; $parentPageLink = get_permalink($parentPostId); $parentTitle = get_the_title($parentPostId); print ‘<li><a href=”https://wordpress.stackexchange.com/questions/243836/<?php $parentPageLink ?>” title=”<?php $parentTitle; ?>”><?php $parentTitle; ?></a></li>’; } … Read more