On the category page, get the category object

Right, hopefully a nice and simple one… I’m on a category page with the id of 4, I want to get the category object back so I can interogate a few values.

I’ve had a good old look in the WP codex with little success, remember I don’t want to get the categories from a post, I want the category object from the current category.

Many thanks,
Ben 🙂

5 s
5

To get the category object use get_category (codex). It’s easy if you know the name, slug or ID, but if you don’t you could use is_category to check on which category you are and pass the ID to get_category.

Leave a Comment