0

I have this example of working search:

<form action="<?php echo esc_url(site_url('/')) ; ?>" method="get">
   <input type="search" name"s">
   <input type="submit" value="search">
</form>

and this works great, but what I want to archive is to make this search work with two more select boxes:

<form action="<?php echo esc_url(site_url('/')) ; ?>" method="get">
   <select name="">
       <option>Option one</option>
       <option>Option one</option>
   </select>
   <select name="">
       <option>Option A</option>
       <option>Option B</option>
   </select>
   <input type="search" name"s">
   <input type="submit" value="search">
</form>

How do I go around to make this post do something like this: mysiteDOTcom/s=option1+optionb+searchinput ? Thanks in advance

0
0

Sorry, it's unclear to me what your goal is, if you could clarify your question more and additional information like what kind of options you're trying to use (are they custom fields, are they categories, tags, or other taxonomies, or another characteristic like post author?)

First, the select inputs should not have blank name values. (visit this a11y guide page for an example of building a search form with select lists as an example although the example is not specific to WordPress.) Having blank name values usually results in errors in a search form.

(Visit for an example search query How do I properly redirect outbound links with special characters)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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