Inspiration For Creative Minds
Home » Labs » Get current category ID of WordPress page  

Filed under Labs

The current category ID is in the global $cat variable, when you are in a category page you can get it as follows.

    if (is_category()) {
		$category = get_category(get_query_var('cat'));
		$cat_id = $category->cat_ID;
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook

Posts you may like: