apply_filters( 'relevanssi_valid_sources', array $sources )
Filters the valid source parameters for log filtering.
Parameters
$sources
(array) A list of string values that are whitelisted for the source parameter.
More information
Relevanssi Premium 2.27.0 added a new feature that allows you to mark your search forms with a rlv_source
parameter and then filter your user search logs based on those values. You can use this to separate user behaviour on different search forms.
To add the parameter, simply add a rlv_source
parameter to your search form. If you use the searchform
shortcode, you can add rlv_source="keyword"
to the shortcode parameters, or you can use a hidden input field in the search form:
<input type="hidden" name="rlv_source" value="keyword" />
Because these values are entered directly into your wp_relevanssi_log
database table, there’s an extra layer of security. You must use this filter hook to whitelist all possible values; any other values will be ignored.
For example:
add_filter( 'relevanssi_valid_sources', function( $sources ) { return array( 'main', 'sidebar', 'knowledgebase' ); } );