[wp-trac] [WordPress Trac] #32272: Built In 'Post' Archive Ignored Using is_post_type_archive()
WordPress Trac
noreply at wordpress.org
Thu May 7 19:42:19 UTC 2015
#32272: Built In 'Post' Archive Ignored Using is_post_type_archive()
--------------------------+---------------------------------------
Reporter: Howdy_McGee | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone:
Component: Query | Version: 4.2.1
Severity: normal | Resolution:
Keywords: | Focuses: administration, template
--------------------------+---------------------------------------
Changes (by Howdy_McGee):
* status: closed => reopened
* resolution: duplicate =>
Comment:
Replying to [comment:1 SergeyBiryukov]:
> Duplicate of #23826.
The linked ticket is not really a duplicate. They're addressing an issue
with `is_post_type_archive( 'post' )` working for Front Page or Blog but
this issue regards actual Post Archives, Month / Year Archives. There's
already `is_category()` for blog categories, `is_tag()` for tags,
`is_author()` for Authors, but nothing specifically targets Post Date
Archive Pages.
The real issue is that on Month / Year Archive Pages,
`is_post_type_archive( 'post' )` will always return false on those pages
so to target those specific pages you have to use `is_archive()` which
will also catch Post Type Archives. You're forced to have your Post Type
Archive conditionals at the top and actual Post Archive `is_archive()`
conditional at the bottom, which even then may catch unintended post type
archives.
This isn't documented very well in the Codex or Code Reference and I feel
is really a bug.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32272#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list