Custom post type and custom taxonomies display

Okay, it seemed that going with more than 1 taxonomy was just wishful thinking.

I settled with this:

CPT still is ‘magazine’

Hierarchical taxonomy terms were used instead:

Parent: The author name
Children: The magazines that each author will publish.

With the code below I managed to get a working taxonomy-authorname.php page:

<?php
$taxonomies = array( 
    'authormagazine' // the custom tax
);

$args = array(
    'orderby'           => 'id', 
    'order'             => 'ASC',
    'hide_empty'        => true,
    'fields'            => 'all', 
    'slug'              => 'andy' // the slug of the author name parent term
); 

$terms = get_terms($taxonomies, $args);
$term_id = $terms[0]->term_id;


$taxonomy_name="authormagazine";
$termchildren = get_term_children( $term_id, $taxonomy_name );

foreach ( array_reverse($termchildren) as $child ) {

    echo '<div class="row">';
    $term = get_term_by( 'id', $child, $taxonomy_name );

    // Here we get the permalink of the first post from each magazine
    $args2 = array(
        'post_type' => 'magazine',
        'tax_query' => array(
            array(
                'taxonomy' => 'authormagazine',
                'field' => 'slug',
                'terms' => $term->slug
            ),
        'posts_per_page' => 1
        ),
    );

    $query = new WP_Query($args2);
    $firstpost_link = $query->posts[0]->ID;

    echo '<div class="col-md-6 mag-title">';
    echo '<h2><a href="' . get_permalink( $firstpost_link ) . '">' . $term->name . '</a></h2>';
    echo '</div>';

    echo '</div>'; // end row
}


?>

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