I realise Wordpress questions are hard to answer, given the plethora of plugins and complications out there.
We've been having some trouble on our Wordpress page where virtual pages will populate their submenu with all the pages that don't have an explicit parent(Parent: (no parent)).
I've isolated the offending code to this piece of code in the header:
<!-- Secondary Nav --> <!-- Show Secondary Menu if the page is a child or has children --> <?php global $post; $children = get_pages( array( 'child_of' => $post->ID ) ); if ( is_page() && $post->post_parent || count( $children ) > 0 ) : ?> <div class="row subnav"> <div class="container"> <div class="columns large-12"> <ul> <?php wp_list_pages( array('title_li'=>'','depth'=>1,'child_of'=>get_post_top_ancestor_id()) ); ?> </ul> </div> </div> </div> <?php else : ?> <!--This is a parent page without children --> <?php endif; ?>
Research has indicated that virtual pages are usually made as a page with children, as opposed to a page without children.
How does Wordpress handle virtual pages with regards to page... childing? This bahaves as expected on normal pages, it gets a list of affiliated menu items.
I've seen the same behaviour on buddypress, and this is currently happening with coursepress.
I guess more importantly, is there a way to separate virtual pages from normal pages in this if statement so it doesn't generate submenus for them?
Here's a couple image examples: