WordPress search submit “?s=” at the end of current page url error?

I tried to custom this cute search bar for my site but when I click on “submit” to start research, the “?s=” ends to be added at the end
of the url of the current page (and not at the end of the blog directory), while the original wordpress theme search box, whatever page you’re visting, when I click on it, starts a correct research. Any fixes?

Obviously when i click on “submit” when I’m not on the page, the search doen’t start.

Related posts

1 comment

  1. It’s because the form action is empty.

    Set it to the base url of your website, and it will cause the form to go there:

    <div id="sb-search" class="sb-search">
        <form action="<?php echo get_bloginfo('url'); ?>">
            <input class="sb-search-input" placeholder="Enter your search term..." type="search" value="" name="search" id="search">
            <input class="sb-search-submit" type="submit" value="">
            <span class="sb-icon-search"></span>
        </form>
    </div>
    

Comments are closed.