• Hello, my search form is not returning results for posts and/or pages and I’d like to figure out why.

    I have the following search form code in the header:

    <div id=”search-form”>
    <form method=”get” id=”searchform” action=”<?php echo home_url(); ?>/”>
    <input type=”text” name=”s” id=”searchinput” />
    <input type=”image” src=”<?php echo get_template_directory_uri(); ?>/images/search_btn.png” id=”searchsubmit” />
    </form>
    </div> <!– end #search-form –>

    The search form displays perfectly in the theme, so that is not the problem. When I search for any word that I know it’s both in the title and the content of several POSTS and PAGES, the page reloads, but does not lead me to the search results, it simply shows the same page where I was.

    The example URL I get after the search is:
    https://example.com/?s=keyword&x=0&y=0

    By the way, I do have a searchform.php containing the following code:

    <form method=”get” id=”searchform” action=”<?php echo home_url(); ?>/”>
    <div>
    <input type=”text” value=”<?php echo esc_attr( get_search_query() ); ?>” name=”s” id=”s” />
    <input type=”submit” id=”searchsubmit” value=”<?php esc_attr_e(‘Search’,’Aggregate’); ?>” />
    </div>
    </form>

    Just a final note, I want wordpress to search both POSTS and PAGES, not only posts.

    thanks.

  • The topic ‘Search Form Not Working’ is closed to new replies.