relevanssi_search_params

apply_filters( 'relevanssi_search_params', array $params, WP_Query $query )

Filters the search parameters after they’ve been compiled.

Parameters

$params
(array) An associative array of search parameters.

$query
(WP_Query) The WP_Query object for the query.

More information

When a search is made, Relevanssi gets the WP_Query object that contains all the query variables in the $query->query_vars array. Relevanssi collects the search parameters from the query variables in the relevanssi_compile_search_args() function in lib/search.php (and relevanssi_compile_common_args()) and puts them in an associative array.

This filter hook happens right at the end of that process and allows you to filter the search parameters. This is not the only way to do that: you can use a pre_get_post action or a relevanssi_modify_wp_query filter hook to adjust the WP_Query object before Relevanssi sees it.

You can also use relevanssi_search_filters to filter the parameters. These two filter hooks are almost the same; the biggest difference is that relevanssi_search_params gets the WP_Query object as a parameter.

Relevanssi uses this filter hook for proximity sorting. The base coordinate parameter is read from the WP_Query to a global variable using a function on this hook.