Linked Questions

Popular Questions

link to custom taxonomy by id

Asked by At

Through a series of specific requirements, I find myself needing to link to a custom taxonomy category using its term id...

I've got this - which displays a link to all taxonomies - I wish to change it so it only displays a link to the taxonomy with the term id dynamically pulled from a custom field I'm using.

$taxonomy = 'event-categories';
$terms = get_terms($taxonomy);
if ($terms) {
foreach($terms as $term) {
echo '<li><a href="http:/mysite.com/events/categories/project-events/' . $term->slug . '">' . $term->name .'</a></li>';
 }
};

essentiall I need "link_to_taxonomy_category(x)" where x = term_id

Thanks

Related Questions