Sounds like you’ll have to code something custom here.
I like the idea TBH – but I haven’t seen anything like this in WordPress before.
As I see it, you’ll have to make a custom SQL query, or maybe even use get_terms()
(Function description here) to achieve your goal.
You would have to:
-
Hook into the search – maybe using the
template_redirect()
(Hook description here) action – I’ve found a Stack Exchange answer on how to do this here. It gives you an idea on how to do this part. -
Now you’ll have to get your search-term, and using something like below, to get the URL for the specific term:
$args = array(
'taxonomy' => 'product_cat',
'name__like' => 'SEARCH_TERM_HERE',
'fields' => 'all',
'hide_empty' => true,
);
$terms = get_terms($args);
- Lastly use
get_term_link()
(Function description here) to get the URL of the term (if any term is found, that is).
This is only a quick outline on how I would start approaching this. I’m sure it can be optimized – but this is definitely how I would start off. You should also make sure that it redirects the user to the normal search-result page if no terms match the search term.