Link of first category page of a custom post from single page

Share Now

Share on facebook
Share on pinterest
Share on twitter
Share on linkedin
Share on email

   $terms = get_the_terms( $post->ID, 'material-category' );
   if ( !empty( $terms ) ){
   // get the first term
   $term = array_shift( $terms );
   $link = get_term_link( $term );
<a href="<?php echo $link; ?>">category Link</a>

Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert