0

We are using the Enfold theme for our website and the default search function does not pull what we need it to pull, it only gets posts. I found a post that said I could put in the following code to change it to relevanssi but I have no idea where to put it and in which file. Help on this or how to change the search function would be appreciated.

add_filter('avf_ajax_search_function', 'avia_init_relevanssi', 10, 4);
function avia_init_relevanssi($function_name, $search_query, $search_parameters, $defaults)
{
    $function_name = 'avia_relevanssi_search';
    return $function_name;
}

function avia_relevanssi_search($search_query, $search_parameters, $defaults)
{
    global $query;
    $tempquery = $query;
    if(empty($tempquery)) $tempquery = new WP_Query();

    $tempquery->query_vars = $search_parameters;
    relevanssi_do_query($tempquery);
    $posts = $tempquery->posts;

    return $posts;
}

1 Answers1

0

This code doesn't do anything by itself. Have you tried installing the Relevanssi WordPress plugin?

You shouldn't need to add additional code after installing the plugin.

shipshape
  • 1,682
  • 2
  • 17
  • 33