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

props wpsmith.
fixes #28412.
Built from https://develop.svn.wordpress.org/trunk@28667


git-svn-id: http://core.svn.wordpress.org/trunk@28485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-06-04 23:43:15 +00:00
parent 1aaa80f48e
commit b33c95079b

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 ) {