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

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 11 16:01:12 UTC 2010


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

Comment(by nacin):

 I believe in_category() needs to be used in the loop. Otherwise WP has no
 idea what post you want to refer to, thus it pulls the first one out of
 $posts.

 If you call query_posts() before the check, it'll work, because the $posts
 array will be set.

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


More information about the wp-trac mailing list