Automattic\Jetpack\Device_Detection
User_Agent_Info::is_bot()
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() User Agent Info::is bot code WPSCache 1.12.4
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; }