Echo taxonomy name – second level

You can use that code to retrieve the last taxonomy term in your taxonomy list:

in your functions.php file create a custom function:

function my_custom_function() {
    global $post;
    $terms = get_the_terms( $post->ID, 'location' );
    if (!empty($terms)) {
        foreach($terms as $term) {
            if (!get_term_children($term->term_id, 'location')) {
                echo $term->name;
            }
        }
    }
}

When, inside your archive.php you should call newly created custom function:

if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
the_title();
the_post_thumbnail();
<need the taxonomy name to go here (3rd child)>
<?php my_custom_function(); ?>

Result:

results

enter image description here