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

Fixes #9470.



git-svn-id: https://develop.svn.wordpress.org/trunk@25244 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-04 20:55:05 +00:00
parent 0e79ec02a6
commit 0b28c0137d
2 changed files with 31 additions and 1 deletions

View File

@@ -3735,8 +3735,13 @@ function get_pages($args = '') {
}
if ( $parent >= 0 )
if ( is_array( $parent ) ) {
$post_parent__in = implode( ',', array_map( 'absint', (array) $parent ) );
if ( ! empty( $post_parent__in ) )
$where .= " AND post_parent IN ($post_parent__in)";
} elseif ( $parent >= 0 ) {
$where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
}
if ( 1 == count( $post_status ) ) {
$where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $post_type, array_shift( $post_status ) );