Make sure posts array is not empty before checking preview state. #2498
git-svn-id: http://svn.automattic.com/wordpress/trunk@3600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b3214d6cc8
commit
18db892b64
|
@ -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