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?
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?
You must be logged in to post a comment.
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:
Replace “your-taxonomy-here” with your own and your ready to go.
See
get_the_terms()
, you’d do something like so: