WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Search redirect not working

[Resolved] Search redirect not working

  • Hi!

    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'); ?>">
    		<div>
    			<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="" />
    		</div>
    </form>

    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!

Viewing 1 replies (of 1 total)
  • 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() ?>
    </form>

    I just removed these tags and everything is working fine.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Search redirect not working’ is closed to new replies.
Skip to toolbar