Make WordPress Core

Ticket #13927: 16850.diff

File 16850.diff, 773 bytes (added by scribu, 14 years ago)

Just use 'post_parent'

  • wp-includes/query.php

     
    21082108                        $where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
    21092109                }
    21102110
    2111                 if ( is_numeric($q['post_parent']) )
    2112                         $where .= $wpdb->prepare( " AND $wpdb->posts.post_parent = %d ", $q['post_parent'] );
     2111                $parent_ids = array_filter( array_map( 'absint', (array) $q['post_parent'] ) );
     2112                if ( !empty( $parent_ids ) ) {
     2113                        $parent_ids = implode( ',', $parent_ids );
     2114                        $where .= " AND $wpdb->posts.post_parent IN ($parent_ids)";
     2115                }
    21132116
    21142117                if ( $q['page_id'] ) {
    21152118                        if  ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) {