Description
Retrieves the permalink for a CPT-onomy term archive page.
Usage
$cpt_onomy->get_term_link( int|object|string $term, string $cpt_onomy );
Parameters
$term (integer|object|string) (required)
Default: none
The term object / term ID / term slug whose link will be retrieved.
$cpt_onomy (string) (required)
Default: none
Name of the CPT-onomy. NOT required if you pass the term object in the first parameter.
Return Values
(string) URL to taxonomy term archive.
Examples
<?php
global $cpt_onomy;
$terms = get_terms( 'actors' );
if ( !empty( $terms ) ) {
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li><a href="' . $cpt_onomy->get_term_link( $term, $term->taxonomy ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
}
?>
Related Functions
WordPress Codex
For more information, refer to the WordPress codex.
