I asked this question on stack overflow but haven't had any joy thus far. Link: https://stackoverflow.com/questions/41716882/wordpress-search-form-and-search-result-through-acf-field-in-custom-taxonomy/41718983#41718983
Copy of the question below:
So I think I'm making life hard for myself.
I have a search field on my website that I have split into 3 e.g:
<input type="text" name="part1" />
<input type="text" name="part2" />
<input type="text" name="part3" />
On my results page I create the search string e.g:
$searchstring = $part1.'-'.$part2.'-'.$part3;
The process then is to search the database for my custom field that has a value of $searchstring
I found a search function https://gist.github.com/jserrao/d8b20a6c5c421b9d2a51 there which I think's rather close to what I'm trying to achieve but I'm not really sure how to implement everything in.
My data roughly looks like this:
(taxonomy) product_cat - (name) Category 1 - (custom field) gc_number - (value I need to search) 77-999-77
(taxonomy) product_cat - (name) Category 2 - (custom field) gc_number - (value I need to search) 73-333-73
(taxonomy) product_cat - (name) Category 3 - (custom field) gc_number - (value I need to search) 76-666-76
I then need to display the product_cat
name to the user.
Hopefully this makes some sense and any help would be greatly appreciated!