Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support display only main cateory (meta terms) Reply To: display only main cateory (meta terms)

#7584
Tom
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 🙂