Hi David,
Pretty sure this is because when using the taxonomy name in the search query string e.g. wpbb_job_location WordPress expects to receive a term slug not a term name.
For example if you try search for new-york you should get the jobs in New York. Therefore you could change the input for that field from a text input to a select input and the values of the options would be the term slugs.
@dabeecher, did you ever find a solution to the search? If so would you please mind sharing?
Thanks
@wackyracer8 we offer a search plugin for sale which adds search capability to the WP Broadbean plugin.
https://store.highrise.digital/downloads/wp-broadbean-search/
@wackyracer8 I just hooked upto the search query and amended it so I could do it with the full name…
I’ve added my code below which worked for me
function advanced_search_query($query) {
if($query->is_search()) {
if (!empty($_GET['search_location'])):
$slug = str_replace(" ", "-", $_GET['search_location']);
$tax_query = array(
array(
'taxonomy'=>'wpbb_job_location',
'field'=> 'slug' ,
'terms'=> $slug,
),
);
$query->set('tax_query',$tax_query);
endif;
return $query;
}
}
add_action('pre_get_posts', 'advanced_search_query', 1000);
Just a quick tip – you should never be using $_GET parameters raw. They should always be checked first using the WordPress sanitization function. Therefore replace:
$slug = str_replace(" ", "-", $_GET['search_location'] );
With this:
$slug = str_replace(" ", "-", sanitize_text_field( $_GET['search_location'] ) );
@dabeecher Cheers, that has worked a treat. Top man.