Make WordPress Core

Ticket #13927: 13927.diff

File 13927.diff, 1.4 KB (added by nacin, 15 years ago)
  • wp-includes/query.php

     
    12261226                }
    12271227
    12281228                $array_keys = array('category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in',
    1229                         'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and');
     1229                        'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'post_parent__in', 'post_parent__not_in');
    12301230
    12311231                foreach ( $array_keys as $key ) {
    12321232                        if ( !isset($array[$key]))
     
    18271827                        $where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
    18281828                }
    18291829
    1830                 if ( is_numeric($q['post_parent']) )
     1830                if ( is_numeric( $q['post_parent'] ) ) {
    18311831                        $where .= $wpdb->prepare( " AND $wpdb->posts.post_parent = %d ", $q['post_parent'] );
     1832                } elseif ( $q['post_parent__in'] ) {
     1833                        $post_parent__in = implode(',', array_map( 'absint', $q['post_parent__in'] ) );
     1834                        $where .= " AND $wpdb->posts.post_parent IN ($post_parent__in)";
     1835                } elseif ( $q['post_parent__not_in'] ) {
     1836                        $post_parent__not_in = implode(',',  array_map( 'absint', $q['post_parent__not_in'] ) );
     1837                        $where .= " AND $wpdb->posts.post_parent NOT IN ($post_parent__not_in)";
     1838                }
    18321839
    18331840                if ( $q['page_id'] ) {
    18341841                        if  ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) {