First of all my this post is related to : Link 1 and Link 2

I made my custom taxonomy page : My Custom Taxonomy Page link is : //localhost/myproject/?motion=aamir-khan . this page is custom taxonomy page ( note : no custom page , only custom taxonomy )

but now there is new requirement Of Custom Search page in which only my custom taxonomy data will be search : like if any one search aamir khan ,salman khan — then after submit on my custom search button the same page should be seen as of my custom taxonomy .. not default wordpress search page

Hence i add below custom search form at my header :

<form role="customsearch" method="get" id="customsearchform" action="<?php echo home_url('/'); ?>">
<div>
<label for="s">Search for:</label>
<input type="text" value="" name="motion" id="motion" />
<input type="submit" id="customsearchsubmit" value="Search Motion" />
</div>
</form>


I have place above custom search button at my header.php

Hence if any one search with aamir khan then the custom taxonomy page should be seen but i am getting ” Page not found “

Why page not found : because after search with my custom search form the link generated is : //localhost/myproject/?motion=aamir+khan

where as my custom taxonomy page link generated is : //localhost/myproject/?motion=aamir-khan

same when any one search for salman khan or any other data:

//localhost/myproject/?motion=salman+khan

but my actually custom taxonomy link generated is :

//localhost/myproject/?motion=salman-khan

In short if after search i want my url should be with “-” not with “+”

i want custom search only for my custom taxonomy data page hence if url rewriting then only for customsearch form

Note my default search should not be effected , as i want that to in my website . hence one wordpress default search button , and another my custom search button which only for my custom taxonomy page .

Read more here: Custom Search only for my Custom Taxonomy Page - data


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: