Opened 19 years ago
Closed 19 years ago
#1171 closed defect (bug) (fixed)
Page caching, wp_list_pages and child_of
Reported by: | mdawaffe | Owned by: | ryan |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 1.5.1 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
Currently, using child_of in wp_list_pages only returns the direct children of the passed value rather than the entire subhierarchy below that page.
Example:
Page1
-Page2
-Page3
--Page4
-Page5
Calling wp_listpages(child_of=1) yields a listing of Pages 2, 3, and 5. NOT 4.
This can be remedied by using $cache_pages when possible in wp_list_pages() instead of calling get_pages().
Patch submitted.
Attachments (1)
Change History (8)
#4
@
19 years ago
Recursion is still broken.
I have the following (where the numbers are the Page ID):
New Page(3)
-testing(12)
-one(15)
--test(4)
wp_list_pages(sort_column=post_title&child_of=3);
displays:
one(15)
-test(4)
Instead of:
one(15)
-test(4)
testing(12)
and wp_list_pages(sort_column=ID&child_of=3);
displays:
testing(12)
Instead of:
testing(12)
one(15)
-test(4)
The problem is with the recursive referencing. Or at least changing the get_page_children function definition from:
function &get_page_children($page_id, &$pages)
to:
function &get_page_children($page_id, $pages)
(note lack of ampersand on $pages)
fixes things.
http://trac.wordpress.org/changeset/2480