HOME / BLOG / BLOG-POST

How to get the category of current post in wordpress?

<?php 
  //get the category of current post in wordpress
  foreach((get_the_category()) as $category) 
  { echo $category->cat_name . ' '; } 
?>

 


about authors

Sandip Das

Web Developer

Once a legend said “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” – Martin Fowler.



POST COMMENTS

2 replies on “How to get the category of current post in wordpress?”


Leave a Reply

Your email address will not be published. Required fields are marked *