Ensure that the post type object is the queried object when a post type has been registered with has_archive => true. Ensure it is not stomped when decorated with tax_query. Adds unit tests.

Props nacin.
Fixes #18614.



git-svn-id: https://develop.svn.wordpress.org/trunk@25291 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-06 22:06:40 +00:00
parent 63f35ba4b4
commit 48dc7e576b
5 changed files with 68 additions and 6 deletions

View File

@@ -3147,10 +3147,10 @@ class WP_Query {
* @return bool
*/
function is_post_type_archive( $post_types = '' ) {
if ( empty( $post_types ) || !$this->is_post_type_archive )
if ( empty( $post_types ) || ! $this->is_post_type_archive )
return (bool) $this->is_post_type_archive;
$post_type_object = $this->get_queried_object();
$post_type_object = get_post_type_object( $this->get( 'post_type' ) );
return in_array( $post_type_object->name, (array) $post_types );
}