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 would like to modify WordPress default search.

I have 2 questions: which template file to modify, and how can I include posts ids that I want to include in search?

I need to search from specific post ids, so I want to modify search in this particular way.

share|improve this question
There is a whole page of information at the WP Codex on Creating a Search Page – Brady May 17 '11 at 17:01
up vote 1 down vote accepted

The output of search results is controlled by search.php template (or generic index.php if it's not present).

And search is technically a usual WordPress loop with s query argument, so any snippets that apply to loops can be used to tweak search.

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.