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

How do I override the search template i.e. used inside a theme with a custom search page inside a plugin? Please point our any relevant action/filter hooks which can be used to do this.

Any help is highly appreciated.

share|improve this question
up vote 1 down vote accepted

You can use template_include filter hook


function my_custom_search_template($template){
    global $wp_query;
    if (!$wp_query->is_search)
        return $template

    return dirname( __FILE__ ) . '/my_search_template.php';

share|improve this answer

If i read your question correctly then it has been answered on stackoverflow. The link covers creating custom page templates upon plugin activation and also covers template redirect hook.

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.