How would I go about having 5 search pages on my site, each of which searches within a different category?
I know I would use this in my functions.php if I wanted the search functionality on the whole site to only search specific categories.
function SearchFilter($query) {
if ($query->is_search) {
// Insert the specific categories you want to search
$query->set(‘cat’, ‘8,9,12’);
}
return $query;
}
add_filter(‘pre_get_posts’,’SearchFilter’);
Or is the answer to only return or echo the results from certain categories?