i'm looking for a way to made search query only in custom post type and sometimes filter out category.
I'm having code which builds search query but WordPress still returns posts and job-ads.
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search">
<label class="sr-only" for="s"><?php esc_html_e( 'Search', 'understrap' ); ?></label>
<div class="input-group">
<input class="field form-control" id="s" name="s" type="search"
placeholder="<?php esc_attr_e( 'Otsi …', 'job-ads' ); ?>" value="<?php the_search_query(); ?>">
<input type="hidden" name="post_type" value="job-ads">
</div>
</div>
<div class="col-md-3">
<div class="input-group">
<?php wp_dropdown_categories( array(
'show_option_all' => __('All job ads', 'job-ads'),
'taxonomy' => 'tookategooria',
'name' => 'category',
'orderby' => 'name',
'echo' => 1,
'selected' => $cat,
'hierarchical' => true,
'class' => 'cat-dropdown',
'id' => 'custom-cat-drop',
'value_field' => 'term_id'
) ); ?>
</div>
</div>
<div class="col">
<span class="input-group-append">
<input class="submit btn" id="searchsubmit" name="submit" type="submit"
value="<?php esc_attr_e( 'Search', 'understrap' ); ?>">
</span>
</form>
My custom post type is registered also without plugin, publicly querable and other settings have been checked.
If i'm using my search string manually then it still returns all the posts
String www.domain.com/?s=&post_type=job-ads&category=323
It won't work without category either.
For search results i'm using template which renders loop as in Worpress own theme search results. Basically all of the code is built on same basis.
Any ideas how to force WordPress to display search results correctly?