So I have custom taxonomy called "cars". I would want that when user does search, it would also search through taxonomy. Meaning that in "cars" taxonomy if I have "Audi" term and user search with keyword "audi" it would then return posts that are tagged with term "audi".
I tried this:
function mytheme_pre_get_posts( $query ) {
$query->set( 'tax_query', array(
array(
'taxonomy' => 'cars',
'field' => 'name',
'terms' => $_GET['s'],
)
));
add_action( 'pre_get_posts', 'mytheme_pre_get_posts', 1 );
But that breaks the search completely. Can this be done even or did I miss something?