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

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 5 22:40:38 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           |
----------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:   => close
 * milestone:   => Awaiting Review


Comment:

 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.

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


More information about the wp-trac mailing list