Scroll to top

How to Get Category name from Post ID in wordpress?


Notice: Undefined variable: string in /home/u665484253/domains/wpcodekit.com/public_html/wp-content/themes/twentytwenty-child/functions.php on line 61

Get Category name from Post ID

$category_detail=get_the_category('4');//$post->ID
foreach($category_detail as $cd){
echo $cd->cat_name;
}

Get more information

Read More Posts

Leave a Reply

Your email address will not be published.