WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if it is possible to have the wordpress search results displayed on a different page?

At the moment they are displayed on http://www.mysite.com/?s=searchterm but I would like them displayed on my search-results template page, so http://www.mysite.com/search/?s=searchterm.

Is this possible?

Any help greatly appreciated, S.

share|improve this question
up vote 3 down vote accepted

You created a page with the slug search to "capture" that URL, but WordPress by default already uses that URL for search results. So you were "lucky" that this worked for you, and this is the reason the redirect supermethod mentioned will work.

So, instead of creating a "fake" page to hold the template, you should just rename the template to search.php, like tnorthcutt suggested. If you still want to have content from the page defined in the admin area, I suggest you rename this page and get it via get_posts() or another method, because the main loop will contain search results, not this specific page.

share|improve this answer

I had a problem similar recently where the search results were going to the root rather than the /blog/ slug where I actually wanted the results displayed. I solved it by creating searchform.php and simply wrote a custom search template:

<form role="search" method="get" id="searchform" action="<?php echo home_url( '/blog/' ); ?>">
        <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" />

The secret is in the <?php echo home_url( '/blog/' ); ?> bit. By default wordpress will resolve to the home directory, like this <?php echo home_url( '/' ); ?>. So all you have to do is specify which directory you want your search results to display. If searchform.php exists in your theme it will use that. If not it will use the default form included in the wordpress core functions.

share|improve this answer

Try this plugin (or read the source too see how the redirect is done - its only a few lines of code).


share|improve this answer

It looks like you may just need to rename your template page. Try creating a search.php template file: http://codex.wordpress.org/Theme_Development#Search_Results_.28search.php.29

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.