Skip to content

Instantly share code, notes, and snippets.

@vicso-name
Created October 19, 2021 07:42
Show Gist options
  • Save vicso-name/3d38db6773ccc5c18027b06d0711eb5c to your computer and use it in GitHub Desktop.
Save vicso-name/3d38db6773ccc5c18027b06d0711eb5c to your computer and use it in GitHub Desktop.
How to get terms title and link to the term. This method also works for custom taxonomy.
<?php
$terms = get_the_terms( $current_post_id, 'products' );
foreach($terms as $term) {
$term_title = $term->name;
$term_link = get_term_link($term);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment