Automattic\Jetpack\Device_Detection

User_Agent_Info::is_bot()public staticWPSCache 1.0

Was the current request made by a known bot?

Method of the class: User_Agent_Info{}

No Hooks.

Return

true|false.

Usage

$result = User_Agent_Info::is_bot();

User_Agent_Info::is_bot() code WPSCache 1.9.1

public static function is_bot() {
	static $is_bot = null;

	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
		return false;
	}

	if ( $is_bot === null ) {
		$is_bot = self::is_bot_user_agent( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating.
	}

	return $is_bot;
}