Subpages in Menu Editor not Nesting

LoganGoesPlaces asked

I am building a website for a public school district. All of our school buildings have common pages with the same name (i.e. Library, Nurse, Attendance, etc) that are nested under their parent building’s page. While trying to update our site navigation, I’ve noticed that for some reason the Menus -> Pages -> View All area is not nesting the building pages under their building and is instead listing them alphabetically.

Pages not nesting

The odd thing is, I have nested pages set up in other areas of the site and they do nest themselves on the list.
Pages that are nesting

Am I missing something? I can’t find anything different about the way I nested the pages that do display properly vs those that don’t. I double checked the nested pages and they have their building listed as their parent.

I find this extremely frustrating. Unless I go in and edit all of the pages under a specific building to force them into the recent list I have no idea which page is which.

  • I do NOT want to add the building name to each page title.
  • These pages are nested 3 levels deep (Schools -> Building Name -> Page Name)

If there isn’t a way to fix the way the list displays, is there maybe a way to add the parent page’s name to the page name? Or another way to build the menus?


The function you’re looking for is wp_list_pages().

Pay particular attention to these two arguments documented on that page.

  • depth being the most relevant to your question.

    ‘depth’ (int) Number of levels in the hierarchy of pages to include in the generated list. Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and n (pages to the given n depth). Default 0.

  • There’s also child_of, giving you the option to list only those that are children of a specific parent page that you have; i.e., a specific building’s child pages.

    ‘child_of’ (int) Display only the sub-pages of a single page by ID. Default 0 (all pages).

Tip: One more option is to use a combination of get_pages() and wp_list_pages() as shown by example here. Between the two, you should be able to display the hierarchy as desired.

Share This
Posted in: