Make sure posts array is not empty before checking preview state. #2498
git-svn-id: https://develop.svn.wordpress.org/trunk@3600 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cd75b0ceb9
commit
be34c79158
|
@ -654,7 +654,7 @@ class WP_Query {
|
||||||
$this->posts = $wpdb->get_results($this->request);
|
$this->posts = $wpdb->get_results($this->request);
|
||||||
|
|
||||||
// Check post status to determine if post should be displayed.
|
// Check post status to determine if post should be displayed.
|
||||||
if ($this->is_single || $this->is_page) {
|
if ( !empty($this->posts) && $this->is_single || $this->is_page ) {
|
||||||
$status = get_post_status($this->posts[0]);
|
$status = get_post_status($this->posts[0]);
|
||||||
//$type = get_post_type($this->posts[0]);
|
//$type = get_post_type($this->posts[0]);
|
||||||
if ( ('publish' != $status) ) {
|
if ( ('publish' != $status) ) {
|
||||||
|
|
Loading…
Reference in New Issue