Why?
This is because the pretty permalink:
/tag/online-lectures/?cat=7
gets translated to the ugly permalink:
index.php?tag=online-lectures&cat=7
And as you can see the /tag/online-lectures
part no longer has the emphasis it once had. Afterall /category/arrester?tag=online-lectures
would boil down to exactly the same ugly URL.
Since the resulting query is an archive, and the most specific template available is archive.php
it chooses that template.
Remember, it’s not the URL that determines which template gets loaded, it’s the main query. The URL is converted from /pretty/style/permalinks to index.php?ugly=style
, which is then used to create the query parameters, which get put into the main query, which fetches the posts. After that WP uses the main query object to run through the template hierarchy and pick a template to load.
Changing The Template
Your assumption may have been incorrect, but that doesn’t mean you can’t use the template you expected. It just means you need a filter to identify this situation and load a different template instead using template_include
.
For example, here we request natalia.php
from the theme if we put ?natalia=1
in the URL:
add_filter( 'template_include', 'natalia_template' );
function natalia_template( $template ) {
if ( isset( $_GET['natalia` ) ) {
return 'natalia.php';
}
return $template;
}
You can use a similar filter to inspect the query variables and choose the template you prefer.