[wp-trac] [WordPress Trac] #27326: wp_list_pages - exclude parameter changes behaviour depending on depth

WordPress Trac noreply at wordpress.org
Sat Mar 8 15:01:39 UTC 2014


#27326: wp_list_pages - exclude parameter changes behaviour depending on depth
--------------------------+-----------------------------
 Reporter:  nosnurg       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Let's say I have four top level pages with IDs 1,2 and 3 and each has
 three children, say, (11,12,13), (21,22,23) and (31,32,33).

 If I run
 {{{
 <?php wp_list_pages(); ?>
 }}}
  on that I'll get all the pages shown. So it'll be a list like:

 {{{
 1
     11
     12
     13
 2
     21
     22
     23
 3
     31
     32
     33
 }}}


 If I run
 {{{
 <?php wp_list_pages(exclude=3); ?>
 }}}
  then page 3 will not be shown and the hierarchy will collapse so 31,32,33
 appear in the top level of the hierarchy. So what I'll get is:

 {{{
 1
     11
     12
     13
 2
     21
     22
     23
 31
 32
 33
 }}}

 Given the existence of a separate ''exclude_tree'' argument, that is
 pretty much what I'd expect to happen, after all it has to show the child
 pages somehow. If I now introduce a ''depth'' argument so it is:
 {{{
 <?php wp_list_pages(depth=3&exclude=3); ?>
 }}}
  I'd expect the same thing to happen as the ''depth'' shouldn't make any
 difference. What actually happens is that the
 ''exclude'' now behaves similarly to ''exclude_tree''. What I actually get
 is:

 {{{
 1
   11 12 13
 2
   21 22 23
 }}}

 Now that to me doesn't make sense.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27326>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list