wordpress get taxonomy term by slug code example
Example 1: wordpress get taxonomy of a post
<?php $term_obj_list = get_the_terms( $post->ID, 'taxonomy_name' ); ?>
Example 2: wordpress get current taxonomy
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
echo $term->name; // will show the name
echo $term->slug; // will show the slug
Example 3: How do I get current taxonomy "term id" on wordpress?
$obj = get_queried_object();
echo $obj->term_id;