Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 5 weeks ago

#24384 closed defect (bug) (invalid)

get_pages('parent=1') returns nothing

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


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
11 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Documentation for that functions is here:

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
11 years ago

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