Force WP to use a certain search template

You can use template include filter to use it on every search request.

Let’s assume the advanced search page template you are using is 'wp-advanced-search.php' you can use locate_template to get its path:

add_action('template_include', 'advanced_search_tmpl');

function advanced_search_tmpl( $template ) {
  if ( is_search() ) {
     $t = locate_template('wp-advanced-search.php', false);
     if ( ! empty($t) ) $template = $t;
  }
  return $template;
}

Leave a Comment