Add a new input to the form, the name is key, you can easily access query vars that match a paremeter supporter by WP_Query using the function get_query_var
.
For example, you could try to generate an URL like this:
http://example.com/?s=test&tag=5-personas,4-personas
And with get_query_var(tag)
, you get the values, and the you create a custom WP_Query
using that parameters.
$query = new WP_Query(
array(
's' => get_query_var('s'),
'tag' => get_query_var('tag')
) );
One thing you have to take into account is that can’t have the same parameter twice in the URL, well, you can, but you can’t use the get_query_var
function to get the value.
You can use jQuery to get the selected options from a select
element with the multiple
attribute, and pass the selection to an input with the name “tag”, there are other workarounds for this.
The query wont affect performance that much.
I hope this gives you and idea of what to do.