Prevent PHP Notices on 404 pages

git-svn-id: https://develop.svn.wordpress.org/trunk@13691 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2010-03-13 07:47:20 +00:00
parent fa7d038cae
commit e7b6cd83c7

View File

@ -2665,7 +2665,7 @@ class WP_Query {
} elseif ( $this->is_posts_page ) {
$this->queried_object = & get_page(get_option('page_for_posts'));
$this->queried_object_id = (int) $this->queried_object->ID;
} elseif ( $this->is_single ) {
} elseif ( $this->is_single && !is_null($this->post) ) {
$this->queried_object = $this->post;
$this->queried_object_id = (int) $this->post->ID;
} elseif ( $this->is_page && !is_null($this->post) ) {