Skip to content

Instantly share code, notes, and snippets.

@mrfoxtalbot
Created January 4, 2016 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrfoxtalbot/281f176c2f8d28daccbb to your computer and use it in GitHub Desktop.
Save mrfoxtalbot/281f176c2f8d28daccbb to your computer and use it in GitHub Desktop.
add_filter( 'wpcf7_validate_email*', 'custom_email_confirmation_validation_filter', 20, 2 );
function custom_email_confirmation_validation_filter( $result, $tag ) {
$tag = new WPCF7_Shortcode( $tag );
if ( 'your-email-confirm' == $tag->name ) {
$your_email = isset( $_POST['your-email'] ) ? trim( $_POST['your-email'] ) : '';
$your_email_confirm = isset( $_POST['your-email-confirm'] ) ? trim( $_POST['your-email-confirm'] ) : '';
if ( $your_email != $your_email_confirm ) {
$result->invalidate( $tag, "Por favor comprueba que tu email coincide." );
}
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment