Setting get_queried_object

As per its laconic source:

function get_queried_object() {
    global $wp_query;
    return $wp_query->get_queried_object();
}

This function retrieves object from main query. As such it is affected by anything that changes main query. From your list that would be query_posts() (reason number umpteen it should not be used).

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