Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#14679 closed defect (bug) (invalid)

in_category returns true for parent cat if last item on page is from tested subcat

Reported by: Usurper Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Template Keywords: in_category, categories
Focuses: Cc:


Assume the following category structure


If in_category is used to test for subcat, it will return true if the user is viewing site.com/category/parent and its loop is displaying posts from parent and its subcategory, and the last post on the page is from the subcategory.

Viewing pages 2, 3, 4, and 5 of posts led to the diagnosis, and inserting test posts at the end of pages that were showing the problem confirmed the bug.

Upgraded to 3.0.1 to see if the problem was resolved. It persists.

Change History (1)

#1 @scribu
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

in_category() is meant to test wether the current post in The Loop belongs to a certain category.

You are trying to use it like is_category(), which is a conditional tag.




Note: See TracTickets for help on using tickets.