Targeting custom post type via functions.php doesn’t work

If you want to filter the query for a taxonomy archive, you should check if the query is for that archive:

if ( $query->is_tax( 'book_cat' ) ) {
    $query->set('orderby', 'meta_value');   
    $query->set('meta_key', 'published');    
    $query->set('order', 'ASC');
}

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