I have the following structure:
TOP PAGE
SUB PAGE 1
--- SUB SUB PAGE 1
--- SUB SUB SUB PAGE 1
---- SUB SUB SUB SUB PAGE 1
--- SUB SUB SUB PAGE 1
--- SUB SUB SUB PAGE 1
---- SUB SUB SUB SUB PAGE 1
How can I get the TOP PAGE url from any of the SUB PAGES?
For example: Get TOP PAGE url from ---- SUB SUB SUB SUB PAGE 1
With this I can only get the previous page url and not the Top parent ulr
if ( $post->post_parent ) {
$parent_page_link = get_permalink( $post->post_parent ); // getting parent URL
}
There are many topics with related question but I can not solve my problem.
Thanks,