2
votes

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.

1
codex -- wp_get_post_terms() - David

1 Answers

1
votes

Use:

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