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.


1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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