Get the Terms for a Post or Custom Taxonomy

Get the Custom Taxonomy Term assigned to your posts.

$taxonomy  = 'leadershiptype';
$terms = get_the_terms( $post->ID, $taxonomy );
if ( !empty( $terms ) ){
    // get the first term
    $term = array_shift( $terms );
    
}

Then you can do cool things and echo stuff.

// Echo the slug
echo $term->slug; 

// Echo the Name
echo $term->name; 

// Echo the Description
echo $term->description;  

Ect, Ect…

Leave a Reply

Your email address will not be published. Required fields are marked *

23 − = 21