relevanssi_log_query

apply_filters( 'relevanssi_log_query', string $logged_query, string $query_with_synonyms, WP_Query $wp_query )

Filters the search query before it is logged.

Parameters

$logged_query
(string) The query string without synonyms added.

$query_with_synonyms
(string) The query string with the synonyms.

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

More information

If the relevanssi_log_queries option is enabled, Relevanssi passes the query string through this filter hook and then passes it onto relevanssi_update_log() for logging.

By default, Relevanssi logs the original search query without the possible synonyms added to the query. If you want Relevanssi to log the query with the synonyms included, you can switch the behaviour with this filter hook.

add_filter( 'relevanssi_log_query', function( $logged_query, $query_with_synonyms ) { return $query_with_synonyms; }, 10, 2 );

This filter hook can be used to selectively block queries from being logged. If the filter hook sets the query to an empty value, relevanssi_update_log() will immediately return without doing anything. However, in most cases, the better place to control the logging is the relevanssi_ok_to_log filter hook. If your conditions depend on the WP_Query object, this filter hook is good for that.