[wp-trac] [WordPress Trac] #16347: is_post_type_archive doesn't return correctly outside of loop

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 24 21:14:22 UTC 2011


#16347: is_post_type_archive doesn't return correctly outside of loop
------------------------------+------------------
 Reporter:  blt4              |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.1
Component:  Post Types        |     Version:  3.1
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+------------------

Comment (by markjaquith):

 Tested the patch with the following:

 {{{
 <?php

 add_action( 'init', 'cws_movies_post_type' );

 function cws_movies_post_type() {
         register_post_type( 'movies', array(
                 'labels' => array(
                         'name' => __('Movies'),
                         'singular_name' => __('Movie')
                         ),
                 'public' => true,
                 'show_ui' => true,
                 'rewrite' => array(
                         'slug' => 'movie',
                         'with_front' => false
                         ),
                 'has_archive' => 'movies'
         ) );

 }

 add_filter( 'posts_where', 'cws_posts_where' );

 function cws_posts_where ( $where ) {
         if ( isset( $_GET['is_post_type_archive_test'] ) )
                 var_dump( is_post_type_archive('movies') );
         return $where;
 }
 }}}

 Works with the patch, but not without. In it goes.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16347#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list