apply_filters( 'relevanssi_log_query', string $q_no_synonyms, string $q, WP_Query $query )

Filters the search query string before Relevanssi logs it.


(string) The search query without synonyms added.

(string) The search query with the synonyms added.

(WP_Query) The whole WP_Query object for the search.

More information

In versions 2.13.0 (Premium) and 4.11.0 (free) the Relevanssi behaviour for logging the queries changed. Previously when synonyms were added to the search query, Relevanssi logged the updated query and not the original query the user entered. From these versions onwards, Relevanssi logs the original user-entered query.

If you want to return to the old behaviour, it can be done with this filter hook:

add_filter( 'relevanssi_log_query', 'rlv_log_with_synonyms', 10, 2 );
function rlv_log_with_synonyms( string $q_no_synonyms, string $q ) {
  return $q;