How to Stop the MailChimp Plugin Slowing Down Your Website

mailchimp logoWe recently noticed our website was performing poorly with pages taking between 15 and 20 seconds to load in.

After doing some performance tests we tracked the culprit down to the official WordPress MailChimp sign-up plugin.

As you can see from the image below, our home was taking 16seconds to load in.

The main problem was caused by a call from the MailChimp plugin and the mailchimp.php file.

[code]?mcsf_action=main_css&ver=’.MCSF_VER[/code]

You can see from the images below that this particular request was taking 3.03 seconds to resolve, slowing the entire page time.

Sometimes it can be up to 15 seconds depending on how loaded the server is.

mailchimp-css-request

before-speed-test

So what does ?mcsf_action do?

Not a lot to be honest.

In summary, it outputs a few lines of CSS code to style the sign-up form.  The way it does it however is truly bizarre.

Rather than read in a static file, it outputs the CSS as a header-request, making the server spit out another server transaction every time the widget is called.

The comments in the file say “Outputs the front-end CSS. This checks several options, so it was best to put it in a Request-handled script, as opposed to a static file.”

We think it would be better if they dropped the custom CSS from the Widget options and bundled a static CSS file.  The CSS can easily be overridden from the styles.css file of the users theme.

The Solution

We commented out lines 108 and 109 form the mailchimp.php file in the plugin folder.

[code language=”php”]//wp_enqueue_style(‘mailchimpSF_main_css’, home_url(‘?mcsf_action=main_css&ver=’.MCSF_VER));
//wp_enqueue_style(‘mailchimpSF_ie_css’, MCSF_URL.’css/ie.css’);[/code]

As you can see from the image below, once the lines have been commented out, the overall page speed is vastly decreased.

after-speed-test

Let us know if this fix has improved your page loading speeds.



	

Keep In Touch

Wil

Wil is a dad, consultant, developer, conference organiser, speaker and business mentor. He co-organizes the WordPress Sydney meetup group and has been on the organising committee for WordCamp Sydney since 2014. He speaks at many special events and contributes to the WordPress open source project. His likes are chillies, craft beer and electrogravitics.

1 thought on “How to Stop the MailChimp Plugin Slowing Down Your Website”

Comments are closed.