Get the ID of the root (oldest ancestor, parent without parents) page relative to the current page in a WordPress page template.
Can be helpful for use with wp_list_pages() to create navigation markup.
<?php $root_page_id = ( empty( $post->ancestors ) ) ? $post->ID : end( $post->ancestors ); ?>
Revisions
There are no revisions for this post.
No comments yet.