WordPress.org

Make WordPress Core

Ticket #8592: post-r16235.diff

File post-r16235.diff, 818 bytes (added by sillybean, 9 years ago)

Refreshing patch

  • post.php

     
    33793379        if ( $parent >= 0 )
    33803380                $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
    33813381
    3382         $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status );
     3382        if (current_user_can('read_private_pages') && 'page' == $post_type)
     3383        $where_post_type = $wpdb->prepare( "post_type = '%s' AND (post_status = '%s' OR post_status = '%s')", $post_type, $post_status, 'private' );
     3384    else
     3385        $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status );
    33833386
    33843387        $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
    33853388        $query .= $author_query;