relevanssi_bots_to_not_log

apply_filters( 'relevanssi_bots_to_not_log', array $bots )

Filters the array of bots Relevanssi should block from logs.

Parameters

$bots
(array) The array of bots Relevanssi should block from logging. The array key is the name of the bot and the value is the user agent string for the bot. The default value is

array(
  'Google Mediapartners' => 'Mediapartners-Google',
  'GoogleBot'            => 'Googlebot',
  'Bing'                 => 'Bingbot',
  'Yahoo'                => 'Slurp',
  'DuckDuckGo'           => 'DuckDuckBot',
  'Baidu'                => 'Baiduspider',
  'Yandex'               => 'YandexBot',
  'Sogou'                => 'Sogou',
  'Exalead'              => 'Exabot',
  'Majestic'             => 'MJ12Bot',
);

More information

If you want to block bots from your search logs, this hook can be used to add new bots to the blocklist. Relevanssi gets the user agent of the bot from $_SERVER['HTTP_USER_AGENT'] and compares it against the values in the array filtered by this hook, and if there’s a match (using stristr(), ie. case-insensitive in-string search), the search won’t be logged.

To add a new bot to the list:

add_filter( 'relevanssi_bots_to_not_log', function( $bots ) {
  return array_merge( $bots, array( 'Bad Bot' => 'BadBot' ) );
}

The same bot list is used for blocking bots from search results pages, but there the filter hook is relevanssi_bots_to_block.