WordPress.org

Make WordPress Core

Changes between Initial Version and Version 3 of Ticket #13412


Ignore:
Timestamp:
12/06/13 18:35:27 (4 months ago)
Author:
nofearinc
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13412

    • Property Type changed from defect (bug) to enhancement
    • Property Milestone changed from Unassigned to Future Release
  • Ticket #13412 – Description

    initial v3  
    1 The get_pages() function in post.php returns no results when parent != 0, rather than returning the pages that are children of the immediate page.  
     1The `get_pages()` function in post.php returns no results when parent != 0, rather than returning the pages that are children of the immediate page.  
    22 
    3 Given page ID 30, which has 3 child pages, calling get_pages('parent=30') will return nothing. 
     3Given page ID 30, which has 3 child pages, calling `get_pages('parent=30')` will return nothing. 
    44 
    55The problem is in the following lines (line ~2600 at the time of writing): 
     6 
     7{{{ 
    68if ( $child_of || $hierarchical ) 
    79        $pages = & get_page_children($child_of, $pages); 
     10}}} 
    811 
    912Hierarchical, by default, is set to true, this this conditional will typically be true. When it does so, it filters out all of the pages retrieved up to this point and, by the time it returns, there are no pages left. 
    1013 
    1114The quick work-around I'm currently using is to call the following instead: 
    12 get_pages('parent=0&hierarchical=0'), overriding the default value so that conditional doesn't execute. 
     15{{{ 
     16get_pages('parent=0&hierarchical=0'); 
     17}}} 
    1318 
    14 The one exception to this is that calling get_pages('parent=0') should function even with this bug. 
     19overriding the default value so that conditional doesn't execute. 
     20 
     21The one exception to this is that calling `get_pages('parent=0')` should function even with this bug.