So I built this one calendar functionality within WordPress.  Not thinking to much I build it and used a month and year as query variable names.  Added a rewrite rule so that I could keep the same permalink style without having to do the normal question mark variable equals.  So I test it for a month or two ahead and a month or two back and it appears to be working properly.  

So later on I revisit it again after realizing that when attempting to view a different year it gives a 404 page not found error.  After spending much time playing around with the rewrite rule, using query variables in a different manner I begin to look at the permalink settings page.  Tried changing that to a few different choices to see if that was conflicting and of course nothing there was causing the issue.  So I begin to notice that in most of the permalinks they have a date set.  What if WordPress already uses month or year in some manner and by me overwriting it it is not allowing the page that I know exists to be shown.  Low and behold that resolved the issue.  But what is kind of puzzling to me when I do a get_query_var for either month or year it does not return anything.  What might be happening though is if either of those are set to anything then the permalink engine attempts to find that page name in the archive for that year.

So glad to have found a fix but still not 100% sure as to why.  If anyone can shed some light on the subject, I would not mind the lesson.

Share This

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.