Make WordPress Core

Opened 18 years ago

Closed 13 years ago

#9470 closed enhancement (fixed)

Allow get_pages to get child pages of multiple pages

Reported by: joostdevalk Owned by:
Priority: normal Milestone: 3.7
Component: Query Version: 2.8
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description

I'm doig a lot of WordPress CMS work, and am finding it increasingly annoying that i can only get the children of one page through get_pages.

It would be great if child_of could also, just like include and exclude, be a comma separated array of pages for which you want to fetch the children.

Attachments (2)

9470.diff​ (680 bytes ) - added by wonderboymusic 13 years ago.
9470.2.diff​ (2.7 KB ) - added by wonderboymusic 13 years ago.

Download all attachments as: .zip

Change History (10)

#1 @nbachiyski
18 years ago

  • Keywords needs-patch added

#2 @Denis-de-Bernardy
18 years ago

  • Milestone Unassigned → Future Release
  • Version → 2.8

have you tried there is a page walker class?

#3 @Denis-de-Bernardy
18 years ago

  • Component General → Query

#5 @Japh
14 years ago

  • Cc japh@… added

#6 @wonderboymusic
13 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone Future Release → 3.7

9470.diff​ Allows parent to accept an array:

$p = get_pages();
$p = get_pages( array( 'parent' => 0 ) );
$p = get_pages( array( 'parent' => 7 ) );
$p = get_pages( array( 'parent' => array( 3, 5, 7, 9 ) ) );

#7 @wonderboymusic
13 years ago

  • Keywords commit added

.2.diff adds unit tests and fixes a nasty bug that deletes your results after it finds them if you only pass the parent arg

#8 @wonderboymusic
13 years ago

  • Resolution → fixed
  • Status new → closed

In 25244:

Allow get_pages() to accept an array for the arg parent. Adds unit tests, some will fail until the next commit.

Fixes #9470.

Note: See TracTickets for help on using tickets.