From 8e98240a8053308ec1824fb8269330ae7e3dd311 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Mon, 24 Jan 2011 21:15:50 +0000 Subject: [PATCH] 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 --- wp-includes/query.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 66867afb6..d97ce752a 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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 ); } /**