WordPress.org

Make WordPress Core

Ticket #29167: 29167.diff

File 29167.diff, 587 bytes (added by ebinnion, 6 years ago)

First patch for returning posts that may not be public if the correct post_status has been set.

  • wp-includes/query.php

    diff --git a/wp-includes/query.php b/wp-includes/query.php
    index 1ac8ee0..3a4e7c5 100644
    a b public function get_posts() { 
    34973497                        $status = get_post_status($this->posts[0]);
    34983498                        $post_status_obj = get_post_status_object($status);
    34993499                        //$type = get_post_type($this->posts[0]);
    3500                         if ( !$post_status_obj->public ) {
     3500                        if ( ! $post_status_obj->public && ! in_array( $status, $q_status ) ) {
    35013501                                if ( ! is_user_logged_in() ) {
    35023502                                        // User must be logged in to view unpublished posts.
    35033503                                        $this->posts = array();