Title: Undefined array key &#8220;SERVER_NAME&#8221;
Last modified: November 28, 2025

---

# Undefined array key “SERVER_NAME”

 *  Resolved [richardmichael](https://wordpress.org/support/users/richardmichael/)
 * (@richardmichael)
 * [6 months ago](https://wordpress.org/support/topic/undefined-array-key-server_name-2/)
 * There are a few threads on this but none of them were actually mine, it is probably
   best practice to not hijack others.
 * error_log is filled with this error:
 * `[28-Nov-2025 14:44:06 UTC] PHP Warning: Undefined array key "SERVER_NAME" in/
   home/username/public_html/wp-content/plugins/mailchimp-for-woocommerce/includes/
   class-mailchimp-woocommerce-enhanced-logger.php on line 258`
 * I might have identified the problem for you. The plugin is relying on SERVER_NAME,
   but if you use cronjobs or WP-CLI, that isn’t populated either at all, or the
   same.
   For our websites, we have WP Cron and rely on a cronjob. I see another 
   unresolved thread where someone is using WP-CLI.
 * Google’s AI (I know I know) suggestion:
 * > Use $current_site->domain: For WordPress-specific operations, it is more reliable
   > to use the $current_site global object, which stores the domain variable ($
   > current_site->domain), instead of relying on $_SERVER[‘SERVER_NAME’]. This 
   > ensures that the correct domain information is used regardless of whether the
   > command is executed via the web or WP-CLI.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [KJ](https://wordpress.org/support/users/kjvextras/)
 * (@kjvextras)
 * [6 months ago](https://wordpress.org/support/topic/undefined-array-key-server_name-2/#post-18735987)
 * Hi [@richardmichael](https://wordpress.org/support/users/richardmichael/) Huge
   thank you for creating your own thread on this. We are already working on a fix–
   please stay tuned for our next release
 * Thanks again! We appreciate you so much!
 *  Plugin Support [KJ](https://wordpress.org/support/users/kjvextras/)
 * (@kjvextras)
 * [2 months, 2 weeks ago](https://wordpress.org/support/topic/undefined-array-key-server_name-2/#post-18847126)
 * Hi there, we have included this feature in our latest release! [Download the latest version v6.0](https://github.com/mailchimp/mc-woocommerce/releases/tag/v6.0)
   and if you’re happy with this integration, please consider leaving a [5-star review](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/).
   Your feedback helps other WooCommerce customers find this integration and helps
   support future development.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fundefined-array-key-server_name-2%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/mailchimp-for-woocommerce/assets/icon-256x256.png?rev=1509501)
 * [Mailchimp for WooCommerce](https://wordpress.org/plugins/mailchimp-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailchimp-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [KJ](https://wordpress.org/support/users/kjvextras/)
 * Last activity: [2 months, 2 weeks ago](https://wordpress.org/support/topic/undefined-array-key-server_name-2/#post-18847126)
 * Status: resolved