Home › Forums › Pro Support › display only main cateory (meta terms) › Reply To: display only main cateory (meta terms)
February 3, 2019 at 10:39 am
#7584
Keymaster
Hey Alex,
Give this a shot:
add_filter( 'wpsp_terms_output', function() {
$all_terms = get_the_terms( get_the_ID(), 'category' );
$first_term = $all_terms[0];
$url = get_term_link( $first_term->term_id );
return sprintf( '<span class="wp-show-posts-terms wp-show-posts-meta"><a href="%1$s">%2$s</a></span>',
$url,
$first_term->name
);
} );
Let me know 🙂