[wp-trac] [WordPress Trac] #18993: is_post_type_archive() returns true in the admin area

WordPress Trac wp-trac at lists.automattic.com
Sun Oct 7 03:17:57 UTC 2012


#18993: is_post_type_archive() returns true in the admin area
----------------------------+------------------------------
 Reporter:  johnbillion     |       Owner:
     Type:  defect (bug)    |      Status:  reopened
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.3
 Severity:  normal          |  Resolution:
 Keywords:  close           |
----------------------------+------------------------------

Comment (by mintindeed):

 Replying to [comment:6 SergeyBiryukov]:
 > Replying to [comment:5 mintindeed]:
 > > is_post_type_archive() is analogous to is_archive(), which returns
 false in the same scenario.
 > `is_post_type_archive()` returns true if `post_type` query variable is
 set, which is the case in your example. And `is_archive()` then actually
 returns true as well: [[BR]]
 > http://core.trac.wordpress.org/browser/tags/3.4.2/wp-
 includes/query.php#L1572
 >
 > As noted above, if you don't want your filter functions to run in the
 admin, the solution is to add `is_admin()` check.


 I still find it inconsistent.  When you're on edit.php for non-custom post
 types (e.g., post), is_archive is false.  That's the point I was trying to
 illustrate.

 As far as I can tell, no other template conditional tags return true in
 the admin.

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


More information about the wp-trac mailing list