ワードプレス
メール確認
functions.php
add_filter( 'wpcf7_validate_email', 'wpcf7_text_validation_filter_extend', 11, 2 ); add_filter( 'wpcf7_validate_email*', 'wpcf7_text_validation_filter_extend', 11, 2 ); function wpcf7_text_validation_filter_extend( $result, $tag ) { $type = $tag['type']; $name = $tag['name']; $_POST[$name] = trim( strtr( (string) $_POST[$name], "n", " " ) ); if ( 'email' == $type || 'email*' == $type ) { if (preg_match('/(.*)_confirm$/', $name, $matches)){ $target_name = $matches[1]; if ($_POST[$name] != $_POST[$target_name]) { if (method_exists($result, 'invalidate')) { $result->invalidate( $tag,"確認用のメールアドレスが一致していません"); } else { $result['valid'] = false; $result['reason'][$name] = '確認用のメールアドレスが一致していません'; } } } } return $result; }
contact form7
[email* your-email] [email* your-email_confirm]