You can add a custom tax_query
to your filter, and pass the search query to it:
function searchfilter($query) {
if ($query->is_search && !is_admin() ) {
$s = $query->get( 's' );
$query->set('post_type', [ 'lesson', 'series' ] );
$query->set(
'tax_query',
[
[
'taxonomy' => 'your-taxonomy',
'field' => 'name',
'terms' => $s ,
]
]
);
}
return $query;
}
add_action('pre_get_posts','searchfilter');