1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
function wpm_email_validation_filter( $result, $tag ) { $tag = new WPCF7_Shortcode( $tag ); if ( 'EMAIL-CONFIRM' == $tag->name ) { $your_email = isset( $_POST['EMAIL'] ) ? trim( $_POST['EMAIL'] ) : ''; $your_email_confirm = isset( $_POST['EMAIL-CONFIRM'] ) ? trim( $_POST['EMAIL-CONFIRM'] ) : ''; if ( $your_email != $your_email_confirm ) { $result->invalidate( $tag, "Are you sure this is the correct address?" ); } } if ( 'EMAIL' == $tag->name ) { $email = isset( $_POST['EMAIL'] ) ? trim( $_POST['EMAIL'] ) : ''; if ( email_exists( $email ) ) { $result->invalidate( $tag, "This email already exists, please choose another." ); } } return $result; } add_filter( 'wpcf7_validate_email*', 'wpm_email_validation_filter', 20, 2 ); |