File: /var/www/html/wp-content/mu-plugins/00_mailchimp_override.php
<?php
/**
* Override Liquid_MailChimp class to prevent frontend API calls
* The newsletter widget calls get_mailchimp_lists() in register_controls()
* which makes a curl request to Mailchimp API, taking 10+ seconds on frontend
*/
// This file must load BEFORE hub-core loads the real class
// Define the class early to prevent hub-core from overriding it with the real one
// (class_exists check in mailchimp.php will prevent redefinition)
if (!class_exists('Liquid_MailChimp')) {
class Liquid_MailChimp {
public function __construct($api_key, $api_endpoint = null) {
// No-op - prevent real Mailchimp initialization
}
public function get($method, $args = [], $timeout = 10) {
// On frontend, return empty result instantly (no API call)
if (!is_admin() && !wp_doing_ajax()) {
return [];
}
// In admin, we could make the real call, but for now return empty
return [];
}
public function post($method, $args = [], $timeout = 10) {
return [];
}
public function getLastError() {
return false;
}
public function getLastResponse() {
return ['body' => ''];
}
public function getLastRequest() {
return [];
}
}
}