More than two years ago I wrote the post Add a category filter to WordPress search form to explain how I added a category filter to the WordPress search form using WordPress API and some custom code and one of the most asked question was how to add a multiple tags filter to the search form, so here it is, a tutorial that covers all the steps to add multiple category filter to WordPress search.
If you are impatient and want to see the final result, this is a sceenshot of the search page.
Getting the tags list
In the previous post I used the standard method wp_dropdown_tags to get the tags list, now we need to generate a checkbox list instead of a dropdown list so we are going to build a custom method in the functions.php file:
This method generates a list of tags with a checkbox for every category. The value of the checkbox is the category ID. Now we need to customize the search.php template adding a call to the function am_dropdown_tags:
Manage the search form
The filter is now fully functional, but we need to customize the search result page to list the tags