[resolved] Search redirect not working (2 posts)

  1. Haidi
    Posted 5 years ago #


    Search is not working on my site, and it is driving me crazy. Maybe there is simple option somewhere to change this?

    Search works fine on front page, but elsewhere it tries to search only current category or post, not the whole site. Search URL points to http://www.mysite.com/category/post/?s=searchstring which is not correct.

    My searchform.php looks like this:

    <form method="get" id="searchform" action="<?php echo bloginfo('home'); ?>">
    			<label class="screen-reader-text" for="s"></label>
    			<input class="searchfield" type="text" value="Hae.." name="s" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" / />
    			<input type="submit" class="searchbutton" value="" />

    I've also tried action="<?php bloginfo('home'); ?>"> , action="/index.php" and other options, none seems to make difference. I also tried default theme preview, where search works fine, so there is something wrong with my theme?

    I've tried to search answer for hours, so any help would be very much appreciated!

  2. Haidi
    Posted 5 years ago #

    Okay feel really stupid now..

    On my header.php I had get_search_form() call inside <form> tag which made the false redirect. Like that:

    <form class="searchform">
    	<?php get_search_form() ?>

    I just removed these tags and everything is working fine.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.