I've added a custom form to one of my page templates. It submits to itself $_SERVER['REQUEST_URI']
in hopes I can grab the $_GET
values and modify my query using pre_get_posts
, but instead it goes to 404.
So to clarify, I don't want to use search.php, I want it to post back to my page template and modify my query to show the "filterd" results instead of 404ing.
I've tried using pre_get_posts
to test if it's 404 or search, but I also don't want to stop anything else from 404ing.
So how can I use a query on the same page / url / page template without needing to reply on search.php
or having my query cause a 404?
So with the custom search form in place the url is currently http://mydomain.com/page-slug/?year=1111
- and I want to modify the query on the specific page depending on the $_GET
value.