Get is_post_type_archive( 'my-post-type' ) working properly outside of the loop. props bit4. fixes #16347
git-svn-id: https://develop.svn.wordpress.org/trunk@17358 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
daecb5d36d
commit
e51e83d0c9
@ -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
Block a user