vitaliikovalenko.com/blog

WordPress: How to get custom taxonomy data

First, we need to get the array of objects with get_the_terms() function:

$terms = get_the_terms($post->id, 'taxonomy-name');

Then we are walking through the array picking up the data bits we need from the objects (there will be only one object in most cases):

foreach ($terms as $term) {
    $termslug = $term->slug;
}

We can get access to many different properties this way: name, slug, description,.. and of course, the custom ones too.