dynamically limit depth of wp_list_pages
This is a little tricky, and my solution may not be the best for the performance. You may add this Value as a Custom Field to the Page, so you do not have to query it everytime. // get the ancestors of the page, and check if the page is toplevel $parent = array_reverse( get_post_ancestors( … Read more