WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Search Not Working – Shows Everything

[Resolved] Search Not Working – Shows Everything

  • Ce3ge
    Member

    @ce3ge

    Hey, so this is my first go at creating a WordPress blog from scratch. I’ve searched for hours and couldn’t find an answer. Here’s my problem:

    The search form that I have implemented on my site isn’t working properly. When you search for something, it displays all of my posts. For example, when I search for the word “epic” (which is in only one of my posts), it displays all of my posts.

    After the research I’ve done, the URL I get after I search seems to be correct: http://localhost/wordpress/?s=epic

    Right now I don’t have a search.php and I’m falling back on the index.php. This is the code I’m using to generate the search form:

    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
        <div><label class="screen-reader-text" for="s">Search for:</label>
            <input type="text" value="" name="s" id="s" />
            <input type="submit" id="searchsubmit" value="Search" />
        </div>
    </form>

    Any help would be greatly appreciated. I’m pretty green when it comes down to PHP – so keep that in mind. 🙂 Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Search Not Working – Shows Everything’ is closed to new replies.