[wp-trac] Re: [WordPress Trac] #5708: wp_list_pages() will not list subpages by ID if the parent is not included.

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 28 20:34:01 GMT 2008


#5708: wp_list_pages() will not list subpages by ID if the parent is not included.
---------------------------+------------------------------------------------
 Reporter:  chippeterson   |        Owner:  hailin 
     Type:  defect         |       Status:  closed 
 Priority:  normal         |    Milestone:  2.7    
Component:  General        |      Version:  2.3    
 Severity:  normal         |   Resolution:  invalid
 Keywords:  list subpages  |  
---------------------------+------------------------------------------------
Changes (by hailin):

  * status:  assigned => closed
  * resolution:  => invalid

Comment:

 This is not an issue with the latest wporg builds.
 I've tested with similar page structure, and it appears to be fine.

 In your case, 23 should be displayed at the very end, because it is an
 "orphan page" - pages whose parents do not exist.

 Note that the comment for walk() function has:
 * max_depth = -1 means flatly display every element
 * max_depth = 0  means display all levels
 * max_depth > 0  specifies the number of display levels.

 so as long as 0 is passed in, every page will be displayed, regardless of
 it is an  orphan page or not.  However, if 0 is not passed in, orphan page
 will be skipped.
 By default, 0 is used in wp_list_pages().

 Below is the logic in the code where the orphan page is handled, just FYI.

 wp-includes/classes.php
 function walk( $elements, $max_depth)
 /*
 * if we are displaying all levels, and remaining children_elements is not
 empty,
 * then we got orphans, which should be displayed regardless
 */
 ....

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5708#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list