Search form options group categories

You can use in search query wp public query vars.

When searching in multiple categories, wordpress accepts comma separated category ids in url &cat=1,2,5

Now I can come up with only such simple solution.

  1. Get rid of wp_dropdown_categories
  2. use e.g. get_categories, so you can customize SELECT attribute name into cat[] (which is also possible with wp_dropdown_ca…, but keep with me)
  3. set SELECT attribute to multiple
  4. after submitting form when user has choosen multiple values, you should get an POST array of category IDs, you now format them into comma separated values and redirect the user into the new URL, e.g. www.site.com/?s=cars&cat=1,45,45
  5. The idea about redirecting the user to URL, which WordPress can read and provide you a proper result

Another way is, when an user is picking categories, with Javascript you get the picked options and set a hidden input like so <input type="hidden" name="cat" value="1,5,10">. Now you do not have a need to additional redirect.

(My sentiment was only to provide a way, how it can be done. Take my solution only as illustration.