pagination errors for search with custom queries

I needed to add a one-off search form for the Home page. The form would search “Tour” Custom Post Types with a category or “vacations”.

I used a native WordPress Text widget and this code:

<form method="get" class="searchform" action="http://knightlytours.com/" role="search">
	<input type="text" class="field" name="s" value="" placeholder="Search">
	<input type="hidden" value="vacations" name="category_name" />
	<input type="hidden" value="tours" name="post_type" />
</form>

The search results worked, but the pagination was wrong: The pagination links doubled the search query, like this

http://knightlytours.com/?s=denali&category_name=vacations&post_type=tours&s=denali&category_name=vacations&post_type=tours&page=2

I Googled the issue, but all I got were ways to effect all search results. I just want to fix the pagination for this one form.

I was under a deadline, so to fix this issue I removed the pagination from all searches.

Is there a way to fix this for my one-off form?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.