Avoid a PHP notice when using WP_Query::get_queried_object() in pre_get_posts action.

props wpsmith.
fixes #28412.

git-svn-id: https://develop.svn.wordpress.org/trunk@28667 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-06-04 23:42:09 +00:00
parent 2948b6d35a
commit 0b5eac467f

View File

@ -3723,7 +3723,7 @@ class WP_Query {
$page_for_posts = get_option('page_for_posts');
$this->queried_object = get_post( $page_for_posts );
$this->queried_object_id = (int) $this->queried_object->ID;
} elseif ( $this->is_singular && !is_null($this->post) ) {
} elseif ( $this->is_singular && ! empty( $this->post ) ) {
$this->queried_object = $this->post;
$this->queried_object_id = (int) $this->post->ID;
} elseif ( $this->is_author ) {