Link to Topmost Page in Heirarchy

$top_page_url = get_permalink( end( get_ancestors( get_the_ID(), 'page' ) ) );

Use the above text in place of the_permalink(); in order to retrieve the link information for the topmost page ancestor.

Leave a Reply

Posted in php
katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.