I’ve two fields with the same name name=”s[]”, but this creates an array, I don’t need an array instead I’d like to construct a string.
I’m using these fields to submit search query to wordpress, if I will use an array I will have to mess with wordpress core, which I don’t want. So my only option is to create 1 single string from two fields and submit it to query.
What do you think?
I think there are two options:
Submit the form to a different page, which redirects to the normal WordPress search page
Catch the
onSubmitevent using JavaScript and rewrite / add to the form dataI would prefer option 1 because it will work for browsers that don’t use JavaScript. If you go with option 2, then you should not even show your two-field search interface to browsers that don’t have JavaScript.