WordPress.org

Make WordPress Core

Ticket #6939: post.diff

File post.diff, 1.2 KB (added by imwebgefunden, 7 years ago)

Patch for wp-includes/post.php

  • post.php

    old new  
    18801880                'sort_column' => 'post_title', 'hierarchical' => 1, 
    18811881                'exclude' => '', 'include' => '', 
    18821882                'meta_key' => '', 'meta_value' => '', 
    1883                 'authors' => '' 
     1883                'authors' => '', 
     1884                'include_private_pages' => 1 
    18841885        ); 
    18851886 
    18861887        $r = wp_parse_args( $args, $defaults ); 
     
    19521953                } 
    19531954        } 
    19541955 
     1956        $page_status = "(post_status = 'publish'"; 
     1957        if ( $include_private_pages && current_user_can('read_private_pages') ) 
     1958                $page_status .= " OR post_status = 'private'"; 
     1959        $page_status .= ')'; 
     1960 
    19551961        $query = "SELECT * FROM $wpdb->posts " ; 
    19561962        $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; 
    1957         $query .= " WHERE (post_type = 'page' AND post_status = 'publish') $exclusions $inclusions " ; 
     1963        $query .= " WHERE (post_type = 'page' AND $page_status ) $exclusions $inclusions " ; 
    19581964        // expected_slashed ($meta_key, $meta_value) -- also, it looks funky 
    19591965        $query .= ( empty( $meta_key ) | empty($meta_value)  ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ; 
    19601966        $query .= $author_query;