admin管理员组

文章数量:1302956

I would like to expand Wordpress / WooCommerce search to allow for formulating a query-string that includes custom taxonomies. The default query-string only takes the variable ?s= followed by a search string. I've found various posts, such as this one, that give examples of how to expand this to search custom taxonomies, etc. But it's all done through the same query-string variable (s).

I'd like to pass the exact taxonomy and it's value, or any combination thereof.

For example:

I have custom WooCommerce product taxonomy (set up through Advanced Custom Fields) such as tax1, tax2, tax3.

I have set up a search form that has a drop-down selector for each of these, populated by the values from each custom taxonomy.

I want the user to be able to select an item in one or more of the drop-downs. Upon hitting submit, this should do to a search-results page, that is able to parse the query-string. Which might be something like ?s=&tax1=the-selection&tax2=&tax3=another-selection

The page will then display search results for all products that have tax1 equal to the-selection AND tax3 equal to another-selection.

What would be the recommended way to go about this? Can I achieve this through coding it into functions.php file, or is it best achieved through an existing plug-in?

本文标签: Search custom taxonomy via querystring