Obtenir l'ID à terme actuel
<?php $current_term = get_queried_object()->term_id; ?>
Bad Booby
<?php $current_term = get_queried_object()->term_id; ?>
You need to pass an additional argument to get_terms(). The default is to hide
"empty" terms-- terms which are assigned to no posts.
$terms = get_terms([
'taxonomy' => $taxonomy,
'hide_empty' => false,
]);
$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
$obj = get_queried_object();
echo $obj->term_id;