Created
October 29, 2014 19:01
-
-
Save thomasgriffin/fadfec5c1d13a0f6c531 to your computer and use it in GitHub Desktop.
Prevent email addresses from being added to Pardot if they end with certain domain names.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'optin_monster_pre_optin_pardot', 'tgm_om_block_specific_email_domains' ); | |
function tgm_om_block_specific_domains( $data ) { | |
// If no email passed, return. | |
if ( empty( $data['email'] ) ) { | |
return $data; | |
} | |
// Check for specific email domains. If there is a match, set email to false to prevent from sending to Pardot. | |
if ( strpos( $data['email'], '@gmail.com' ) !== false || strpos( $data['email'], '@hotmail.com' ) !== false || strpos( $data['email'], '@yahoo.com' ) !== false ) { | |
$data['email'] = false; | |
} | |
// Return the potentially modified data. | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment