• Hi! I just updated to Pardot 2.0.0 and my local debug logs started filling with notices and I was running into issues saving posts. I traced it to the Pardot plugin: line 94 in pardot.php is causing an error to be thrown because the third parameter needs to be an array. I was able to resolve the error by simply wrapping the third parameter in array(), but this is obviously just a temporary bandaid.

    I logged into Pardot to contact support, but my seat doesn’t have access to support, so I’m hoping posting here will do the trick.

    PROBLEM: wp_localize_script( ‘build/index.js’, ‘ajaxurl’, admin_url( ‘includes/admin-ajax.php’ ));

    ERROR: Function WP_Scripts::localize was called <strong>incorrectly</strong>. The <code>$l10n</code> parameter must be an array.

    SOLUTION: wp_localize_script( ‘build/index.js’, ‘ajaxurl’, array(admin_url( ‘includes/admin-ajax.php’ )));

    Thanks for your help!

    • This topic was modified 1 year, 8 months ago by mkonji.
Viewing 1 replies (of 1 total)
  • Also having this issue. The solution above will not fix the problem.

    wp_localize_script( 'build/index.js', 'ajaxurl', admin_url( 'includes/admin-ajax.php' ));

    Changing the third parameter to an array will create a javascript variable of

    var ajaxurl{'0', 'URL VALUE')

    Meaning that the JS here

    xhr.open('POST', ajaxurl)

    Will not have the correct url unless it is also changed to something like
    xhr.open('POST', ajaxurl[0])

    Best choice is to not update until this is corrected.

Viewing 1 replies (of 1 total)
  • The topic ‘Line 94 in pardot.php causing error since recent update (2.0.0)’ is closed to new replies.