Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 22 months ago

#24384 closed defect (bug) (invalid)

get_pages('parent=1') returns nothing

Reported by: tomdxw Owned by:
Priority: normal Milestone:
Component: General Version: 3.5.1
Severity: normal Keywords:
Cc: Focuses:

Description

get_pages('parent=1') returns an empty array
get_pages('parent=1&hierarchical=0') returns an array of pages
get_pages('parent=0') returns an array of pages

(assuming there is a page with ID=1 and it has children)

It seems like if parent=0 works then parent=1 should also work.

Change History (2)

#1 @MattyRob
13 years ago

  • Resolutioninvalid
  • Status newclosed

Documentation for that functions is here:
http://codex.wordpress.org/Function_Reference/get_pages

It indicates there are two valid options for the argument 'parent', namely -1 (to return all pages) and 0 (to return top level pages only).

I suspect the function you need is get_children() that will return a passed page ID and all of it's children.

#2 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review
Note: See TracTickets for help on using tickets.