PatrickC
PatrickC

Reputation: 101

Display custom taxonomy associated to a specific custom post

I created a custom post type named "company" and have a custom taxonomy "sector" with a few categories created for it.

now I created a post under "company" and assigned a few categories for this post. How to I display the categories that this post is associated to within the post? I tried get_terms() but that just gives me every single category within the taxonomy.

Upvotes: 2

Views: 67

Answers (1)

Matteo Enna
Matteo Enna

Reputation: 1301

Use:

$array = get_the_terms($post->ID,array('taxonomy' => 'category'));

Upvotes: 1

Related Questions