Get current category name and ID

How to get current category’s name and ID:

<?php 
	foreach((get_the_category()) as $category) 
        { 
	  $postcat= $category->cat_ID; 
	  $catname =$category->cat_name;
	  //echo $postcat;
	  //echo $catname;
	} 
?>

Revisions

There are no revisions for this post.

Tags: , ,

No comments yet.

Leave a Reply