use get_the_category()
<?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?>
Note: It will return a list of categories if there are more than one category
use get_the_category()
<?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?>
Note: It will return a list of categories if there are more than one category