[wp-trac] [WordPress Trac] #15667: wp_list_pages, if it finds no pages to display, shows random child pages instead because of a bug in get_pages()

WordPress Trac noreply at wordpress.org
Sun Feb 9 01:26:12 UTC 2014


#15667: wp_list_pages, if it finds no pages to display, shows random child pages
instead because of a bug in get_pages()
-------------------------------------------------+-------------------------
 Reporter:  bobsoap                              |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Query                                |  Release
 Severity:  minor                                |     Version:  3.0.2
 Keywords:  good-first-bug needs-unit-tests      |  Resolution:
  has-patch                                      |     Focuses:
-------------------------------------------------+-------------------------
Changes (by jackreichert):

 * keywords:  needs-patch good-first-bug needs-unit-tests => good-first-bug
     needs-unit-tests has-patch


Comment:

 What's causing this is a condition in the walk method in class-wp-
 walker.php.

 If you notice the comment on line 219 says
 >         When none of the elements is top level.
 >         Assume the first one must be root of the sub elements.

 This assumption should fine, except when the depth is limited to 1. That's
 when the above condition fails. The secondary condition in the patch fixes
 this.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/15667#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list