[wp-trac] [WordPress Trac] #10230: get_pages function: number and child_of parameters conflict

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 11 10:54:53 UTC 2012


#10230: get_pages function: number and child_of parameters conflict
-------------------------------------+-----------------------------
 Reporter:  ortsaipekim              |       Owner:  ryan
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Template                 |     Version:  2.8
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+-----------------------------
Description changed by SergeyBiryukov:

Old description:

> Passing both number and child_of parameters to get_pages will produce
> nonsensical results.
>
> Within the function number is used first to limit the number of results,
> then child_of is used to establish results within a certain hierarchical
> scope.
>
> So with a structure of:
>
> Parent 1
> Parent 2
> Parent 3
>    Child 1
>    Child 2
>    Child 3
>
> passing a number=2 and child_of=(parent 3 id) will not give the expected
> output. In this case, the result will first be limited to only include:
>
> Parent 1
> Parent 2
>
> so the child_of will be ignored. To produce a more logical result,
> child_of should be evaluated first, then number should be evaluated to
> limit the result set.

New description:

 Passing both number and child_of parameters to get_pages will produce
 nonsensical results.

 Within the function number is used first to limit the number of results,
 then child_of is used to establish results within a certain hierarchical
 scope.

 So with a structure of:
 {{{
 Parent 1
 Parent 2
 Parent 3
    Child 1
    Child 2
    Child 3
 }}}
 passing a number=2 and child_of=(parent 3 id) will not give the expected
 output. In this case, the result will first be limited to only include:
 {{{
 Parent 1
 Parent 2
 }}}
 so the child_of will be ignored. To produce a more logical result,
 child_of should be evaluated first, then number should be evaluated to
 limit the result set.

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10230#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list