﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
16347,is_post_type_archive doesn't return correctly outside of loop,blt4,,"The new {{{is_post_type_archive}}} function depends on the loop being started ({{{$this->posts}}} set) to function correctly when post types are passed to the function.  The function should return correctly even if the loop hasn't been started (aka in a posts_where filter).

For example, from a posts_where filter on an ""event"" archive page:

'''Correct:'''
{{{
is_post_type_archive() => true
}}}


'''Incorrect''' (should return ''true''):
{{{
is_post_type_archive('event') => false
}}}


I am not a Wordpress developer, but I would replace the {{{is_post_type_archive}}} function in {{{wp-includes/query.php}}} with:

{{{
function is_post_type_archive( $post_types = '' ) {
    if ( empty( $post_types ) || !$this->is_post_type_archive )
        return (bool) $this->is_post_type_archive;
      
    return in_array( $this->query_vars['post_type'], (array) $post_types );
} 
}}}
",defect (bug),closed,normal,3.1,Post Types,3.1,normal,fixed,has-patch commit,bturner@…
