I kind of hacked it in, except now when I search for something that doesn’t exist within the FAQs section, the “search again” feature will remove the search_link parameter and subsequent searches will search every post type.
Any ideas?
In functions.php, here’s what I added:
/*
* faqs search filter
*/
function searchfilter($query) {
if ($query->is_search) {
if (strpos($_GET['search_link'], 'faqs') !== false) {
$query->set('post_type',array('qa_faqs'));
}
}
return $query;
}
add_filter('pre_get_posts','searchfilter');