I have three drop down menus that are chained together. Year, Make Model. I need wordpress search results to show their matching results. If I give them all the name="s" then it only searches the final s= in the url.

I basically need to know how to make


turn into:


or whatever gets the job done.

Any suggestions?

1 Answer 1


You should be using different variables in your URL query, such as:


Make sure the name="" in your select inputs reflect the name changes. You will then just need to read in the variables using PHP's $_GET or $_REQUEST global variable. Something like this

$year = ($_GET['year']) ? $_GET['year'] : false;
$make = ($_GET['make']) ? $_GET['make'] : false;
$model = ($_GET['model']) ? $_GET['model'] : false;

You can then use the $year, $make, $model variables in your query if they are not false.

Make sure you also do the proper escaping and filtering of the $_GET variables as well, for security reasons.

  • Where does the code you supplied go exactly? I'm a little confused...
    – dean
    Commented Mar 19, 2012 at 21:00
  • It can go at the top of the search page template (searchpage.php). Once you submit the form, it will goto the mysite.com/?year=2001&make=Chevrolet&model=Express address. Then the top of the search page template you can include that code. Then you can have logic that determines if any of those variables is set, and if it is you can modify the Query to include filtering by the meta value.
    – Dave Hunt
    Commented Mar 19, 2012 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.