How to get the first term for the current taxonomy?

You can use get_queried_object to get the term name.

<?php if( is_tax() ) {
    global $wp_query;
    $term = $wp_query->get_queried_object();
    $title= $term->name;
       
}  ?>

To display: <?php echo $title; ?>

If your on a taxonomy archive page you can use:

<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>

Then to display the term: <?php echo $term->name; ?>

The following properties are available for the $term object:

  • term_id
  • name
  • slug
  • term_group
  • term_taxonomy_id
  • taxonomy
  • description
  • parent
    -count

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)