2

In my template file, I loop through posts that are categorized either web, print, or marketing in a custom taxonomy portfolio.

How do I echo the slug of each posts category?

3

This shouldn't be too hard!

$my_terms = get_the_terms( $post->ID, 'portfolio' );
if( $my_terms && !is_wp_error( $my_terms ) ) {
    foreach( $my_terms as $term ) {
        echo $term->slug;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.