I have a searchform.php file which contains the following code:

<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="searchsumit" value="Search" />
</div>

Also in my index.php I’ve inserted this code:

<div class="search">
    <?php get_search_form(); ?>
</div>

Now When I search for something I get no results. Therefore I added a search.php file to show the results in it but I still don’t get the results. What kind of changes should be made? Or what piece of code is lacking?

Note that I want to show the results in a separate page which must be search.php in WordPress.

Read more here: Search for does not show the search results in WordPress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: