[wp-trac] [WordPress Trac] #15667: wp_list_pages, if it finds no pages to display, shows random child pages instead

WordPress Trac wp-trac at lists.automattic.com
Fri Dec 3 19:12:46 UTC 2010


#15667: wp_list_pages, if it finds no pages to display, shows random child pages
instead
--------------------------+-------------------------------------------------
 Reporter:  bobsoap       |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.0.2          
 Severity:  critical      |    Keywords:  wp_list_pages  
--------------------------+-------------------------------------------------
 How to reproduce:[[BR]]
 - About page is published
 - additionally, there is a number of parent pages[[BR]]
 - these each have a number of children[[BR]]
 - when calling wp_list_pages(), the "exclude" attr excludes all parent
 pages, and display only the About page.

 This works as long as there is at least 1 other page published that is not
 in the list of excluded IDs. In this example, as soon as the About page is
 set to "draft", wp_list_pages stops working correctly.

 So... with no other pages besides the excluded ones published, we do this:

 1) wp_list_pages('title_li=&depth=1&exclude=3,5,7');
 => wp_list_pages SHOULD return nothing, but instead it displays all child
 pages of the first parent page ID in the "exclude" attr (here: 3).

 Now we now add the "exclude_tree" attr just for fun:

 2) wp_list_pages('title_li=&depth=1&exclude=3,5,7&exclude_tree=3,5,7');
 => should again return nothing, but instead, it displays the first-ever
 published child page globally (here: a child page of 5).

 It looked like random behavior at first but I've been able to identify the
 above pattern. I'm guessing it's a failing condition somewhere in the
 function.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15667>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list