Several post types on WP Query by tag and taxonomy

OK, so this code looks really bad, but let’s try to clean it a little bit and make it work…

First of all, there is no need to all that mess with cloning queries. It makes no sense, to be honest. wp_reset_query() will recreate all query based on request, so there is no point in assigning anything to this variable. Also it would be a lot nicer and efficient, if you use your own custom WP_Query instance and not query_posts. Andthe last but not the least… It’s more readable and efficient if you pass args as an array and not as a string…

Saying that your code could look something like this:

<?php
    $term = get_queried_object();
    $tag = $term->slug;
    $artists = new WP_Query( array(
        'posts_per_page' => 18,
        'post_type' => array('post', 'your-other-cpt1', ...),
        'artistas' => $tag,
        'tag' => $tag
    ) );
?>
    <?php if ( $artists->have_posts() ) : ?>
        <?php while ( $artists->have_posts() ) : $artists->the_post(); ?>
        a lot here 
    <?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata(); // there's no need to reset wp_query, since it hasn't been modified now ?>

PS. The only problem I can still see in here is that you query posts that belongs to 2 different taxonomies and has the same term slug in both of these taxonomies. It doesn’t look right to me, but maybe that’s the case on your site… 🙂