Skip to content

Instantly share code, notes, and snippets.

Forked from lorenzocaum/
Created November 5, 2016 19:52
Show Gist options
  • Save wpsmith/82aad6c91a3186f7b7a7e2db5c4ae553 to your computer and use it in GitHub Desktop.
Save wpsmith/82aad6c91a3186f7b7a7e2db5c4ae553 to your computer and use it in GitHub Desktop.
Setup Kicksend's Mailcheck with Event Espresso 4's registration checkout page #optimization

This sample coding will add Mailcheck from Kicksend to your registration checkout page. It is helpful for preventing spelling errors in email addresses.

Step 1 - Setup Mailcheck resources

Download the Kicksend Mailcheck JavaScript file from here:

Then upload the mailcheck.min.js file to your WordPress site. You can add it to this location using an SFTP or FTP client like FileZilla, Cyberduck, or Transmit:


You'll need to create the js folder above. This will then be the final installation location:


Step 2 - Add supporting coding

The sample coding in the next section can be added to your child theme’s functions.php file (do not include the opening php tag) or a site specific plugin:

The value 123 in the sample coding should be changed to the page ID of your actual registration checkout page. This can be found by going to your WP dashboard and clicking on the registration checkout WordPress page. The ID appears at the end of the URL.

For example, if the ID for your registration checkout page was 567, then you should use that value in the sample coding instead of 123.

Here is a demo of how it appears on the registration checkout page for Event Espresso 4:

Additional Notes

var domains in the sample coding in the next section holds an array (a grouping) of domains to check. Additional domains can be added to the array. For example, if you wanted to add, then you would add a comma after the last entry (, then quotes and add the domain between the quotes. Here is an overview of what that might look like:

var domains = ["", "", "", "", "", "", "",
      "", "", "", "", "", "",
      "", "", "", "", "", "", "",""];
//* Load the Mailcheck JavaScript file into the header
function ee_mailcheck_registration_checkout_load_resources() {
if ( is_page( 123 ) ) {
<script type="text/javascript" src="/wp-content/uploads/espresso/js/mailcheck.min.js"></script>
add_action('wp_head', 'ee_mailcheck_registration_checkout_load_resources');
//* Load the settings for Mailcheck into the footer
function ee_mailcheck_registration_checkout_load_settings() {
if ( is_page( 123 ) ) {
<script type="text/javascript">
var domains = ["", "", "", "", "", "", "",
"", "", "", "", "", "",
"", "", "", "", "", "", ""];
var topLevelDomains = ["", "com", "net", "org", "info", "edu", "gov", "mil"];
// var superStringDistance = function(string1, string2) {
// string distance algorithm of your choosing
// }
var selector = 'input[id$=-email]';
$(selector).on('blur', function(){
domains: domains, // optional
// secondLevelDomains: secondLevelDomains, // optional
topLevelDomains: topLevelDomains, // optional
// distanceFunction: superStringDistance, // optional
suggested: function(element, suggestion) {
var $parent = $(selector).parent();
$('.ee-required-text', $parent).remove();
$parent.append('<span class="ee-required-text">Did you mean <a href="#" class="ee-mailcheck">' + suggestion.full + '</a>?</span>');
empty: function(element) {
// callback code
$('').live('click', function(){
$(selector).val( $(this).html() );
return false;
add_action('wp_footer', 'ee_mailcheck_registration_checkout_load_settings');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment