For example, if you have a post assigned to the subcategory Fruit → Bananas and not the category Fruit, the Fruit category archive will show the “Bananas” post, but calling in_category(‘fruit’) for that post always returns false.
For example, if you have a post assigned to the subcategory Fruit → Bananas and not the category Fruit, the Fruit category archive will show the “Bananas” post, but calling in_category(‘fruit’) for that post always returns false.