Get is_post_type_archive( 'my-post-type' ) working properly outside of the loop. props bit4. fixes #16347
git-svn-id: http://svn.automattic.com/wordpress/trunk@17358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4603a50cae
commit
8e98240a80
|
@ -2966,12 +2966,9 @@ class WP_Query {
|
|||
if ( empty( $post_types ) || !$this->is_post_type_archive )
|
||||
return (bool) $this->is_post_type_archive;
|
||||
|
||||
if ( ! isset( $this->posts[0] ) )
|
||||
return false;
|
||||
$post_type_object = $this->get_queried_object();
|
||||
|
||||
$post = $this->posts[0];
|
||||
|
||||
return in_array( $post->post_type, (array) $post_types );
|
||||
return in_array( $post_type_object->name, (array) $post_types );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue