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.
No comments yet.