I am trying to search for posts in specific taxonomies but any time I search, I get results from all the other pages instead of WordPress searching within the selected category in the taxonomy.
I named my taxonomy: “publication_categories”. It contains all categories for a custom post type which I named “publication”. This is the code I have for my custom-search.php:
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<div class="alignleft">
<select name="taxonomy">
<option value="0">Select...</option>
<?php
$theterms = get_terms('publication_categories', 'orderby=name');
foreach ($theterms AS $term) :
echo "<option value='".$term->slug."'".($_POST['publication_categories'] == $term->slug ? ' selected="selected"' : '').">".$term->name."</option>n";
endforeach;
?>
</select>
</div>
<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" class="searchinput" />
<input type="submit" id="searchbutton" value="Search" class="btn" />
</form>
I see a few problems with your code.
so your form should look something like this:
Possibly this added to your form?