Taxonomy page template changing when using query variables

The problem is that category_name is a reserved keyword for the built-in categories for posts. Almost anything category_* is reserved. You can find a list of reserved keywords at the following url:

https://codex.wordpress.org/Reserved_Terms

This includes, but is not limited to:

  • cat
  • category
  • category__and
  • category__in
  • category__not_in
  • category_name
  • term
  • terms

Behind the scenes it sees that you’re using the category_name reserved keyword. It knows categories are a taxonomy of posts and switches to the archive.php template. If the archive.php template did not exist it would default to index.php and try to load posts looking for anything in the test category (taxonomy).