Let's say I have a custom post type (e.g. product
) and a custom taxonomy (e.g. prod_cat
).
What I need to do is to get all my custom taxonomy terms associated with an object of my custom post type.
Here is how I do it inside the loop.
$terms = wp_get_object_terms(get_the_ID(),'prod_cat', array('fields'=>'slugs'));
But it's not working. It returns an empty array.