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

Fixes #9470.


Built from https://develop.svn.wordpress.org/trunk@25244


git-svn-id: http://core.svn.wordpress.org/trunk@25212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2013-09-04 20:56:09 +00:00
parent 6895dc9f8e
commit bf6da40cfc

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 ) );