The Mailchimp popup fix (WordPress)

Seeing errors on your WordPress site after installing the MailChimp WordPress popup widget?

The script you paste in is along these lines:

<script type="text/javascript" src="//" data-dojo-config="usePlainJson: true, isDebug: false"></script>
<script type="text/javascript">
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"","uuid":"(your uuid)","lid":"(your lid)"}) })

and it’s busted. It’ll throw errors requiring jQuery in the root directory of your website.

Put jQuery there and guess what! It’ll overwrite all other jQuery bindings on the page, breaking everything else.

C’mon MailChimp, this sucks.

Drop this nice fix in and you’re on your way. Hat tip to @nickcernis (

add_action('wp_footer', 'add_mailchimp_popout');
function add_mailchimp_popout(){
    // Fill in your MailChimp popup settings below.
    // These can be found in the original popup script from MailChimp.
    var mailchimpConfig = {
        baseUrl: '',
        uuid: '(your uuid)',
        lid: '(your lid)'

    // No edits below this line are required
    var chimpPopupLoader = document.createElement("script");
    chimpPopupLoader.src = '//';
    chimpPopupLoader.setAttribute('data-dojo-config', 'usePlainJson: true, isDebug: false');

    var chimpPopup = document.createElement("script");
    chimpPopup.appendChild(document.createTextNode('require(["mojo/signup-forms/Loader"], function (L) { L.start({"baseUrl": "' +  mailchimpConfig.baseUrl + '", "uuid": "' + mailchimpConfig.uuid + '", "lid": "' + mailchimpConfig.lid + '"})});'));

    jQuery(function ($) {

        $(window).load(function () {