Get Taxonmy Term ID For Current Post

If I wanted to get the category ID for the current post, I would use something like this:

<?php foreach((get_the_category()) as $category) { echo $category->cat_ID . ' '; } ?>

How can I do the same for a a term ID from a specific Taxonomy?

Related posts

Leave a Reply

2 comments

  1. Thanks helgatheviking, it didn’t work as is but you definitely set me on the right path. I got it working by doing the following:

    <?php foreach((get_the_terms($post->ID, 'your-taxonomy-here')) as $term) { echo $term->term_id. ''; } ?>
    

    Replace “your-taxonomy-here” with your own and your ready to go.