Automattic\Jetpack\Device_Detection
User_Agent_Info::is_bot()
Was the current request made by a known bot?
Метод класса: User_Agent_Info{}
Хуков нет.
Возвращает
true|false
.
Использование
$result = User_Agent_Info::is_bot();
Код User_Agent_Info::is_bot() User Agent Info::is bot WPSCache 1.10.0
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; }