WordPress.org

Make WordPress Core

Ticket #7247: 7247.2.diff

File 7247.2.diff, 1.2 KB (added by DD32, 6 years ago)
  • wp-includes/post.php

     
    20362036                'sort_column' => 'post_title', 'hierarchical' => 1, 
    20372037                'exclude' => '', 'include' => '', 
    20382038                'meta_key' => '', 'meta_value' => '', 
    2039                 'authors' => '' 
     2039                'authors' => '', 'parent' => -1 
    20402040        ); 
    20412041 
    20422042        $r = wp_parse_args( $args, $defaults ); 
     
    20492049 
    20502050        $inclusions = ''; 
    20512051        if ( !empty($include) ) { 
    2052                 $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include 
     2052                $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include 
     2053                $parent = -1; 
    20532054                $exclude = ''; 
    20542055                $meta_key = ''; 
    20552056                $meta_value = ''; 
     
    21222123                        $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value); 
    21232124 
    21242125        } 
     2126         
     2127        if ( $parent >= 0 )  
     2128                $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);  
     2129         
    21252130        $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where "; 
    21262131        $query .= $author_query; 
    21272132        $query .= " ORDER BY " . $sort_column . " " . $sort_order ;