[wp-hackers] When archive.php is pulled in the theme, how does it know what category it applies to before (or as) the loop starts?

Dave Mee davemee at gmail.com
Wed Oct 7 10:33:37 UTC 2009

Hi List!

I know it's possible to pull category names from the post in the loop on
that page, but I need to find out what definitive category is being

For example - invoking site.com/category/cat-b will pull up an archive page.
However, if the first post in that category is also a member of cat-a, my
efforts to find a category name are thrown off kilter - the canonical
category should be coming from the URL, rather than the individual posts.

Is there some mechanism to look into the guts of wordpress or the query and
discover which category it thinks it's dealing with?


More information about the wp-hackers mailing list