CF7 email validation (wordpress)

Contact Form 7 confirm email validation.

<?php
/**
 * Contact Form 7 confirm email validation.
 */
add_filter('wpcf7_validate_email*', function($result, $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, "Are you sure this is the correct address?");
        }
    }
    return $result;
}, 20, 2);
?>

functions.php

< toolbox