ControlledChaos
12/27/2016 - 3:49 AM

Gets the slug of the current custom taxonomy then apply to an archive link.

Gets the slug of the current custom taxonomy then apply to an archive link.

<?php
$terms = get_the_terms( $post->ID, 'my_taxonomy' );
	if ( ! empty( $terms ) ) {
	    $term      = array_shift( $terms );
	    $term_slug = $term->slug;
	}
	$term_link = get_bloginfo( 'url' ) . '/' . $term_slug;
?>

<a href="<?php echo $term_link; ?>">Tax term archive</a>

Current Taxonomy Archive Link

WordPress Snippet