Make WordPress Core

Opened 14 years ago

Closed 11 years ago

Last modified 11 years ago

#17015 closed defect (bug) (invalid)

wp_list_pages incorrect hierarchy when using include and sorting by title

Reported by: johncolvin's profile JohnColvin Owned by:
Milestone: Priority: normal
Severity: minor Version: 1.5
Component: Template Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

I am using wp_list_pages to create a page hierarchy. I only want the grandchildren of specific pages, so I generate a list of page IDs to send to wp_list_pages. I sort them by page title. The hierarchy is not handled correctly when a grandchild's title sorts before its parent.

How it should come out:

About Us
 -Board of Directors
   --Annual Reports
 -FAQ
 -Initiatives
  --Ohio...
  --Reach

How it comes out:

About Us
 -Annual Reports
 -Board of Directors
 -FAQ
 -Initiatives
  --Ohio...
  --Reach

I've moved things around and verified that this sorts correctly:

About Us
 -Board of Directors
   --ZZZAnnual Reports
 -FAQ
 -Initiatives
  --Ohio...
  --Reach

If one grandchild has a sort order above its parent, all the grandchildren are pulled above the parent in the hierarchy. For example:

About Us
 -Board of Directors
   --ZZZAnnual Reports
 -FAQ
 -AAAAOhio...
 -Reach
 -Initiatives

Change History (5)

#1 @solarissmoke
14 years ago

exclude has similar weirdness, maybe the same root cause: #10902

#2 @c3mdigital
11 years ago

  • Resolution set to invalid
  • Status changed from new to closed
  • Version changed from 3.1 to 1.5

I don't fully understand your expectations. If you only want the grandchildren of certain pages then why would you be including their parents? Im going to close please reopen if you feel this is still an issue.

#3 @SergeyBiryukov
11 years ago

  • Component changed from General to Template
  • Description modified (diff)

#4 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review deleted

#5 @SergeyBiryukov
11 years ago

Could not reproduce in trunk. My steps:

  1. Created seven pages with the hierarchy from the first example.
  2. Passed the list of page IDs to wp_list_pages() via include.
  3. Got the same output as in the first example.
Last edited 11 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.