WordPress.org

Make WordPress Core

Ticket #6939: 6939.diff

File 6939.diff, 1.6 KB (added by wojtek.szkutnik, 5 years ago)
  • wp-includes/post-template.php

     
    758758                'child_of' => 0, 'exclude' => '', 
    759759                'title_li' => __('Pages'), 'echo' => 1, 
    760760                'authors' => '', 'sort_column' => 'menu_order, post_title', 
    761                 'link_before' => '', 'link_after' => '', 'walker' => '', 
     761                'link_before' => '', 'link_after' => '', 'walker' => '',  
     762                'include_private' => false 
    762763        ); 
    763764 
    764765        $r = wp_parse_args( $args, $defaults ); 
  • wp-includes/post.php

     
    30643064                'authors' => '', 'parent' => -1, 'exclude_tree' => '', 
    30653065                'number' => '', 'offset' => 0, 
    30663066                'post_type' => 'page', 'post_status' => 'publish', 
     3067                'include_private' => false 
    30673068        ); 
    30683069 
    30693070        $r = wp_parse_args( $args, $defaults ); 
     
    31713172 
    31723173        if ( $parent >= 0 ) 
    31733174                $where .= $wpdb->prepare(' AND post_parent = %d ', $parent); 
     3175         
     3176        $page_status = "AND post_status = '%s'"; 
     3177        if ( $include_private ) { 
     3178                $page_status = 'AND ' . get_private_posts_cap_sql( 'page' ); 
     3179        } 
     3180        $where_post_type = $wpdb->prepare( "post_type = '%s' $page_status", $post_type, $post_status ); 
    31743181 
    3175         $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status ); 
    3176  
    31773182        $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where "; 
    31783183        $query .= $author_query; 
    31793184        $query .= " ORDER BY " . $sort_column . " " . $sort_order ;