Changing an item in drop down after 5 latest posts per taxonomy

Have a closer look to the blow code-

$query_args = array(
    'posts_per_page'    => '5',
    'orderby'           => 'post_date',
    'order'             => 'DESC',
);

$listedPosts = new WP_Query($query_args);

// the loop
if ( $listedPosts->have_posts() ) {
    while ( $listedPosts->have_posts() ) {
        $listedPosts->the_post();
        if ( (int) $listedPosts->current_post == 5 ) { // You need to use '==' or '===' for comparison.
            // change the drop down field item to "Visible" from Invisible
        } else {
            // stay as is
        }
    }
}

And-

$queried_object = get_queried_object();
$term_id = $queried_object->term_id;

This above code will give you the term ID when you are at a taxonomy.php page or archive.php page. In single.php page for getting taxonomy terms you need to use the below code-

For inside a loop-

//Do something if a specific array value exists within a post
$term_list = wp_get_post_terms(get_the_ID(), 'taxonomy _name', array("fields" => "all"));
foreach($term_list as $term_single) {
    echo $term_single->slug; //do something here
}

For outside of the loop-

//Do something if a specific array value exists within a post
$term_list = wp_get_post_terms($post->ID, 'product_features', array("fields" => "all"));
foreach($term_list as $term_single) {
    echo $term_single->slug; //do something here
}

Hope that helps.

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