[wp-trac] [WordPress Trac] #32272: Built In 'Post' Archive Ignored Using is_post_type_archive()

WordPress Trac noreply at wordpress.org
Wed May 6 20:19:36 UTC 2015


#32272: Built In 'Post' Archive Ignored Using is_post_type_archive()
--------------------------------------+-----------------------------
 Reporter:  Howdy_McGee               |      Owner:
     Type:  defect (bug)              |     Status:  new
 Priority:  normal                    |  Milestone:  Awaiting Review
Component:  Query                     |    Version:  4.2.1
 Severity:  normal                    |   Keywords:
  Focuses:  administration, template  |
--------------------------------------+-----------------------------
 I've tested this a couple times and using the built-in post type "Post"
 archives then testing against `is_post_type_archive( 'post' )` always
 returns false. It does get caught by the catch-all `is_archive()` on the
 other-hand.

 The expected outcome is when viewing Post Archives to be able to use
 `is_post_type_archive( 'post' )` to specifically target Post Archives.

 A quick way to test this is to add this under `wp_head()`


 {{{
 if( is_post_type_archive( 'post' ) ) {
         die( 'Post Archive' );
 } else if( is_archive() ) {
         die( 'All Archives' );
 }
 }}}

 Which ''always'' evaluates to false on Post Archives.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32272>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list