I'm trying to list the custom taxonomy term that is attached to the post in question (which is a custom post type). I want to list it without it being a link, it is in fact a title.

I've tried this, but it clearly doesn't work. What am I doing wrong?

function woocommerce_output_product_brand() {

$terms = get_the_terms( $post->ID, 'brand' );
foreach($terms as $term){
    echo $term; }

Thanks in advance!

1 Answer 1


First of all, what is $post? If you after the global $post, then you have to declare the global in the function. So on the second line you'll need to put global $post;.

Secondly, $term is an object. If you are after the term's name, use $term->name, for it's slug $term->slug.

See the Codex for some examples of how to use get_the_terms


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.