Make WordPress Core

Opened 16 years ago

Closed 11 years ago

#9470 closed enhancement (fixed)

Allow get_pages to get child pages of multiple pages

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

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 12 years ago.
9470.2.diff (2.7 KB) - added by wonderboymusic 11 years ago.

Download all attachments as: .zip

Change History (10)

#1 @nbachiyski
16 years ago

  • Keywords needs-patch added

#2 @Denis-de-Bernardy
16 years ago

  • Milestone changed from Unassigned to Future Release
  • Version set to 2.8

have you tried there is a page walker class?

#3 @Denis-de-Bernardy
16 years ago

  • Component changed from General to Query

#5 @Japh
12 years ago

  • Cc japh@… added

@wonderboymusic
12 years ago

#6 @wonderboymusic
12 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 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
11 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
11 years ago

  • Resolution set to fixed
  • Status changed from new to 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.