WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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'm sorry for this scholar question, but I'm totaly confused with search in Wordpress. What is the difference beetwen searchpage.php, searchform.php and search.php? Could anybody tell me how it all works? Thanks.

share|improve this question
up vote 8 down vote accepted

Your question is most likely referring to a specific theme, but I'll answer it for the current default Twenty Ten (Wordpress Theme) as it's well documented. You find it in the wp-content/themes/twentyten directory.

The main search template in there is search.php. It is the template file to display the search page. Which means either only the search form or when called for a search, the search results as well.

searchform.php is a template part, so a fragment to hold the search form. The default theme does not ship with it by default, but if it exists it will load it instead of a hardcoded search form. Here is the default search from:

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

That is done in the wordpress function get_search_form() which is part of the core package and used by many themes including Twenty Ten.

searchpage.php is something specific to another theme I guess, as it is not used within the default theme and worpdress core. I assume by name, that it's having the same or a similar meaning as search.php but being specific to some other theme.

share|improve this answer
searchpage.php has an article in the Codex and you can find some tutorials on creating it, but indeed, it seems to be a complete search form with hints, like the one on this site. Maybe in earlier versions of WP search.php was only used to display results and not as a "search start page" when no query was entered? – Jan Fabry Nov 17 '10 at 13:48
Thanks, I realized it. It's just for the specific themes. – glazsasha Nov 17 '10 at 14:10

searchpage.php is a custom page that usually includes searchform.php. It offers functionality for the end-user to enter search criteria and press submit button. The results appear in search.php.

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.