Anspress destroyed my main search, after installing anepress,my theme’s search.php doesn’t work?

3.98K viewsGeneralsearch
0

This is the search result page when I search by my theme search form, my theme is oceanwp.Thanks great!

Answered question
0

Hi!
I also had this problem (version 4.3.2), I solved it adding this inside functions.php in your theme:

function custom_search_template($template)
{
    global $wp_query;
    if ($wp_query->is_search) {
        return locate_template('search.php');
    }
    return $template;
}
add_filter('template_include', 'custom_search_template', 10000);


The problem was that anspress was overwriting the template of the search page with page.php.

The 10000 is the priority of the filter, its necessary to use a number higher than 9999 or else the filter will have no effect, the cause is line 81 in hooks.php inside the anspress plugin.

Answered question