By using those named GET
variables such as year
or monthnum
you effectively short circuit the URL rewrite (if you are using pretty permalinks). This way you end up querying the main WP_Query
instance first and effectively making yours completely useless (well, you do alter the posts_per_page
attribute so there’s that). Anyway, the point is that there is a base class WP
that issues a 404 when the main WP_Query
instance doesn’t return posts (which is the case) and the 404
template is invoked (if your theme has it) or if it’s missing the index
template is used (which seems to be confirmed by your question).
Now, the quickest fix is to basically rename your GET
variables into q_year
or q_monthnum
for example.