Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#24384 closed defect (bug) (invalid)

get_pages('parent=1') returns nothing

Reported by: 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)

comment:1 @MattyRob2 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.

comment:2 @SergeyBiryukov2 years ago

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