Nathan Rice @ get_depth()

Nathan Rice

One way to get the depth of a page is to use the get_post_ancestors() function.

< ?php $ancestors = get_post_ancestors($post); $depth = count($ancestors); ?>