Title: Undefined array key &#8220;HTTP_USER_AGENT&#8221;
Last modified: April 27, 2022

---

# Undefined array key “HTTP_USER_AGENT”

 *  [Brian Henry](https://wordpress.org/support/users/brianhenryie/)
 * (@brianhenryie)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/undefined-array-key-http_user_agent/)
 * `PHP Warning: Undefined array key "HTTP_USER_AGENT" in /path/to/wp-content/plugins/
   country-redirect/country-redirect.php on line 297`
 * I presume this is happening on cron or wp cli.
 * I added a check for `! isset( $_SERVER['HTTP_USER_AGENT'] )` beforehand.

The topic ‘Undefined array key “HTTP_USER_AGENT”’ is closed to new replies.

 * ![](https://ps.w.org/country-redirect/assets/icon-256x256.jpg?rev=2182914)
 * [country-redirect](https://wordpress.org/plugins/country-redirect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/country-redirect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/country-redirect/)
 * [Active Topics](https://wordpress.org/support/plugin/country-redirect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/country-redirect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/country-redirect/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Brian Henry](https://wordpress.org/support/users/brianhenryie/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/undefined-array-key-http_user_agent/)
 * Status: not resolved