Get Category assigned to a post inside Custom post type and Taxonomy

Using the below syntax and passing the needful parameters inside a custom post loop , you can get the category assigned to those specific post.


$cdetail = get_the_terms($post->ID, 'Enter_your_taxonomy_here' );

echo $cdetail[0]->slug;
echo $cdetail[0]->name;

 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s