Automattic\Jetpack\Device_Detection

User_Agent_Info::is_bot_user_agent()public staticWPSCache 1.0

Is the given user-agent a known bot? If you want an is_bot check for the current request's UA, use is_bot() instead of passing a user-agent to this method.

Method of the class: User_Agent_Info{}

No Hooks.

Return

true|false.

Usage

$result = User_Agent_Info::is_bot_user_agent( $ua );
$ua(string)
A user-agent string.
Default: null

User_Agent_Info::is_bot_user_agent() code WPSCache 1.12.1

public static function is_bot_user_agent( $ua = null ) {

	if ( empty( $ua ) ) {
		return false;
	}

	$bot_agents = array(
		'alexa',
		'altavista',
		'ask jeeves',
		'attentio',
		'baiduspider',
		'bingbot',
		'chtml generic',
		'crawler',
		'fastmobilecrawl',
		'feedfetcher-google',
		'firefly',
		'froogle',
		'gigabot',
		'googlebot',
		'googlebot-mobile',
		'heritrix',
		'httrack',
		'ia_archiver',
		'irlbot',
		'iescholar',
		'infoseek',
		'jumpbot',
		'linkcheck',
		'lycos',
		'mediapartners',
		'mediobot',
		'motionbot',
		'msnbot',
		'mshots',
		'openbot',
		'pss-webkit-request',
		'pythumbnail',
		'scooter',
		'slurp',
		'snapbot',
		'spider',
		'taptubot',
		'technoratisnoop',
		'teoma',
		'twiceler',
		'yahooseeker',
		'yahooysmcm',
		'yammybot',
		'ahrefsbot',
		'pingdom.com_bot',
		'kraken',
		'yandexbot',
		'twitterbot',
		'tweetmemebot',
		'openhosebot',
		'queryseekerspider',
		'linkdexbot',
		'grokkit-crawler',
		'livelapbot',
		'germcrawler',
		'domaintunocrawler',
		'grapeshotcrawler',
		'cloudflare-alwaysonline',
		'cookieinformationscanner', // p1699315886066389-slack-C0438NHCLSY
		'facebookexternalhit', // https://www.facebook.com/externalhit_uatext.php
		'feedburner',
		'yacybot', // http://yacy.net/bot.html
		'trendictionbot',  // http://www.trendiction.de/bot;
		'elisabot',
		'linkfluence', // http://linkfluence.com/
		'semrushbot', // https://www.semrush.com/bot/
		'archive.org_bot', // http://archive.org/details/archive.org_bot
		'ezlynxbot', // https://www.ezoic.com/bot
		'siteauditbot', // https://www.semrush.com/bot/
		'snapchat', // https://developers.snap.com/robots
		'applebot', // https://support.apple.com/en-ca/HT204683
		'bne.es_bot', // https://www.bne.es/es/colecciones/archivo-web-espanola/aviso-webmasters
		'google-safety;', // https://www.google.com/bot.html
		'mojeekbot', // https://www.mojeek.com/bot.html
		'linkwalker', // https://www.linkwalker.com/
	);

	foreach ( $bot_agents as $bot_agent ) {
		if ( false !== stripos( $ua, $bot_agent ) ) {
			return true;
		}
	}

	return false;
}