0

I am stuck trying to display a product brand in wp-admin column. This is my code and I get an array, instead of a value, should I use a different function? I've also tried with $term->name but no luck

thanks

case 'product_brand' :
            $terms = get_the_terms( $post->ID , 'product-brand' );
            if( !empty( $terms ) ){
                echo $terms ;
            }
            else{
                echo 0;
            }
            break;
2
  • solved using this case 'product_brand' : $terms = get_the_terms( $post->ID , 'product-brand' ); if( !empty( $terms ) ){ foreach($terms as $term) { echo $term->name; }; } else{ echo 0; } break; Commented Nov 4, 2016 at 13:16
  • Please post solution you found as an answer so that question doesn't haunt site as unanswered. :)
    – Rarst
    Commented Nov 4, 2016 at 16:55

0

Your Answer

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

Browse other questions tagged or ask your own question.