In my website

I have a custom post type named 'building'. Inside the archive of this post type I put a search form with an input search and a category dropdown. The problem is that when I just put a keyword to the search input without selecting a category, I get results only from this post type (this is what I want). But If I select a category I get results from all post types. How do I resolve this?

That is the code I used

<div class="archive-search"><form method="get" id="searchform" action="<?php echo home_url(); ?>/">

<input type="search" class="sb-search-input" placeholder="<?php _e('Search Projects…', 'wpzoom':wink: ?>" name="s" id="s" autocomplete="off" />

<input name="post_type" type="hidden" value="building" />


// output all of our Categories

// for more information see http://codex.wordpre…ference/wp_dropdown_categories

$swp_cat_dropdown_args = array(

'show_option_all' => __( 'Select Category' ),

'orderby' => 'title',

'order' => 'ASC',


wp_dropdown_categories( $swp_cat_dropdown_args );

?> <?php

echo "



<input type="submit" id="searchsubmit" class="sb-search-submit" value="<?php _e('Search', 'wpzoom':wink: ?>" />

<span class="sb-icon-search"></span>


1:04 pm

And that is the archive page of the post type >

How do I resolve this?