[wp-trac] [WordPress Trac] #14846: in_category returning true when last post is from specified category

WordPress Trac wp-trac at lists.automattic.com
Sun Sep 12 16:22:42 UTC 2010


#14846: in_category returning true when last post is from specified category
-----------------------------+----------------------------------------------
 Reporter:  enrique-ramirez  |        Owner:         
     Type:  defect (bug)     |       Status:  closed 
 Priority:  normal           |    Milestone:         
Component:  General          |      Version:  3.0.1  
 Severity:  major            |   Resolution:  invalid
 Keywords:                   |  
-----------------------------+----------------------------------------------
Changes (by nacin):

  * status:  new => closed
  * resolution:  => invalid
  * milestone:  Awaiting Review =>


Comment:

 I'm confused what you're trying to do. in_category() is designed to be
 used within the loop, to ascertain whether said post is in the category
 specified. If it is used outside the loop, it will inevitably check
 whichever the first post is. Since you're calling it before query_posts(),
 then that would be the first post of the original loop.

 Are you thinking of is_category() -- whether you're on a category archive
 page? You may have better luck in the support forums:
 http://wordpress.org/support/.

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


More information about the wp-trac mailing list